PuTTY pscp on Linux in Batch Mode

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello all,

I am working with an application, running on Linux that actually uses pscp  
on Linux itself (compiled into /usr/local/bin/pscp).

I've noticed that, when run, pscp stores its cache in ~/.putty/sshhostkeys.
  So, if I connect to a new server, and asked if I want to store the key, I
 type "y" and it is stored there for future sessions.

However, the application I'm working with uses pscp in batch mode. So, when
 the prompt comes up to verify a host key, it automatically fails because b
atch mode fails on interactive prompts.

My question is how do I tell pscp in batch mode to permanently accept that  
key?  Does PuTTY on Linux store another, global cache somewhere that it can
 read?  On Windows, I believe it uses the registry, which thankfully doesn'
t exist on Linux.  Is it possible to run pscp in batch mode and have it per
manently accept a key so that the prompt is no longer interactive?

Thanks for any help.  I've used PuTTY on Windows as a client for years, but
 never really seen it used in a Linux environment as typically scp/sftp/ssh
 (openssh) is sufficient.


Re: PuTTY pscp on Linux in Batch Mode

ter062424@gmail.com writes:
Quoted text here. Click to load it

Why not use OpenSSH's scp or (preferably) sftp client instead?

Dag-Erling Smørgrav - des@des.no

Re: PuTTY pscp on Linux in Batch Mode

Quoted text here. Click to load it
Quoted text here. Click to load it

No, it _should_ still use the same cache file whether it's in batch or
interactive mode. If it isn't working for you, that's something we
should try to debug.

Are you running the batch-mode pscp in the same environment as the
test interactive one? If you run as a different user or change $HOME,
then the location of the sshhostkeys file will also change. Users can
also set $PUTTYDIR to read configuration from somewhere else.

If you run pscp -batch under strace, can you see in the trace where
it's trying to open a host key file, and check it's finding the right

If you use the -v flag in both the batch and interactive runs, do they
report the same host key fingerprint?
Simon Tatham         "_shin_, n. An ingenious device for

Site Timeline