Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to perform SFTP automation (to get rid of the password prompt). How can I do this?

share|improve this question

migrated from stackoverflow.com Jul 30 '09 at 19:51

This question came from our site for professional and enthusiast programmers.

What platform are you on? –  Peter Mortensen Jul 30 '09 at 22:48

4 Answers 4

Take a look at the VisualCron automation suite. It has built in automation for SFTP and SSH as well as normal FTP. http://www.visualcron.com

share|improve this answer

If security is not a concern then the password can be in clear text in your script. E.g. on Microsoft Windows using pscp from the PuTTY package.


"d:\putty0.58\pscp"  -pw MyNotSoSecretPassWord  u:\outGoing\someFileToTransfer.7z  kingOfTheHill@www.pil.sdu.dk:/srv/www/htdocs/1/MSQuantDynamics/someFileToTransfer.7z

Password: MyNotSoSecretPassWord. User name: kingOfTheHill. Host: www.pil.sdu.dk.

The sftp server in our case runs on a Linux based server.

share|improve this answer

You need to set up a public/private key. How can I automate an SFTP transfer between two servers?

share|improve this answer

My suggestion is using SSH authorized_keys. You will need to create a key on the client side (using ssh-keygen) and then copy the public key to the target side.

client-machine% ssh-keygen -t rsa
client-machine% scp ~/.ssh/id_rsa.pub user@target-machine:~/.ssh/authorized_keys2

Note that if you want to access target-machine from two or more "clients", you can not copy the id_rsa.pub to authorized_keys2 directly. You will need to open authorized_keys2 and paste the id_rsa.pub from each client machine on it (or use the line below to append the content)

client-machine% cat ~/.ssh/id_rsa.pub | ssh user@target-machine \
                'cat >> .ssh/authorized_keys'

Now you can use ssh/scp without user/password information:

client-machine% ssh user@target-machine
client-machine% scp file user@target-machine:~/file
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.