Issue: Whenever a windows batch file (containing command to perform PSFTP
) is triggered via Control-M (services started as LocalServiceAccount), the keys are not getting cached and prompts to store the key every time.
Explanation: We are performing file transfer using psftp.exe
(Putty). When I execute the batch file using my account, I am able to fingerprint and see the keys getting updated in the Registry (under HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\SshHostKeys
)
Effort #1: Created a task in TaskScheduler to run the same command (via a batch file) with the user as the LocalServiceAccount and perform the fingerprinting by adding ECHO "Y" |
before the psftp command, so that it doesn't prompt for the confirmation.
It works, but is only good for test purposes as I don't think it's a good practice when we move to production.
Effort #2: Deleted all the keys and manually added the keys in the registry. It still doesn't work for the LocalServiceAccount, it only works for my account. Fingerprinting is not happening for the LocalServiceAccount.
PsfTP command:
whoami
"C:\Program Files (x86)\PuTTY\psftp" userAccount@HostIPAddreess -i E:\keys\transfer.ppk
(added whoami just to confirm if the user is correct.)
It doesn't matter though if the batch file is triggered via Control-M services (running as LocalServiceAccount) or we run it via the Task Scheduler. In both cases the keys are not getting cached.
Similar Question: Thanks to this post, I got the interim solution to add echo "Y"
: Putty won't cache the keys to access a server when run script in hudson
The LocalServiceAccount is part of the administrators group on the server, so I'm not sure if there are any permissions on the account that are causing the problem.
Any suggestions on what else I should look for is appreciated.