Script to get files from remote server to local server through sftp without prompting for password

Hi,

I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script.

Can anyone help me in automating the script such that it will automatically take the password and fetch the files from the remote server.

Thanks in advance.

Sukesh.

You can use ssh-keys for login or you can specify the password using the sshpass command. The problem with sshpass is that you will have to provide the password in cleat text in your script.

I will suggest using ssh-keys. To generate the ssh-keys use ssh-keygen and to copy the key to your remote use ssh-copy-id . While copying the ssh-key it will prompt for password, but its just for the first time and after that you can do sftp without a password prompt.

another problem with sshpass is that any user can see the password with 'ps' command.

What you want is lftp

It takes a username and password so you can put it in a script.

Excellent program. Copies files and mirrors directories.

google lftp-4.0.10-sol10-sparc-local