sftp non-interactive batch mode

WhateverJoe

echo $row['what_tha'];
I am having a hard time creating a script that needs to grab a file from a remote system using sftp .... non - interactively ...

-b [batch file] works great... but the authentication, I can not get automated....

Any ssh Guru's have any tips or knowhows to get sftp to connect and authenticate with-out std-in ??

Thanks,
 
As far as I understand it, using the -o option you can use all the options from the ssh command for authentication, including non-interactive authentication. So you should probably dig into the ssh man page.
Hope this helps you.

from the ssh man page:
----------------------------------
ssh implements the RSA authentication protocol automatically. The user creates his/her RSA key pair by running ssh-keygen(1) . This stores the private key in $HOME/.ssh/identity and the public key in $HOME/.ssh/identity.pub in the user's home directory. The user should then copy the identity.pub to $HOME/.ssh/authorized_keys in his/her home directory on the remote machine (the authorized_keys file corresponds to the conventional $HOME/.rhosts file, and has one key per line, though the lines can be very long). After this, the user can log in without giving the password. RSA authentication is much more secure than rhosts authentication.
 
When browsing man pages.. I always skip to the sections that have

-t mmddyyyy copies files less............................

I have a bad habit of not reading sections that are not explaining switches.... :)

I'll try it out
 
I recommend using 'expect'-- a great tool for automating interactive applications such as telnet, ftp, etc. Has anyone ported it to Darwin/Mac OS X?

http://expect.nist.gov
 
gumse is right about this. Go with the key method. It'll allow you to securely login to the box via ssh and use all the "s" commands without a password prompt. This is the best way to go unless you have some serious security needs or issues.

John
 
Back
Top