How to automate sftp in a script to 'get' files.

Hi,

I read a couple of forum entries about scripting sftp using the '-b' option, but in my case it still prompts for the password. Does anyone have a sample script for an sftp block to 'get' files from the remote server without prompting for a password?

Both the remote and the local servers are Sun-OS boxes.

Thanks,
CB.

It isn't you script. You have to set up ssh keys on the remote server, keys that have no passphrase on them.

run ssh-keygen -t rsa

  1. hit <return> when it asks for a passphrase. And again. You do not want a passphrase a all.
  2. $HOME/./ssh/id_rsa.pub is the public key.
  3. id_rsa.pub needs to be placed in the remote server home directory/.ssh directory, usually as the file: authorized_keys

If protections on the home directory (your side) match 755 and .ssh matches 700 (both sides)it will work.

All bets are off if you have some weird sftp PC software on the remote end. Most work okay, some do not well at all. IP Switch and Globalscape come to mind....