While I am copying the files from one server to another server using the scp command while I am running in PuTTY it was asking for the password of two server machines. Is there any other way to copy the files without a password or with passwords means how can I pass in the command?

1 Answer 1


By far the best way is to use public/private key pair authentication. If you don't already have a key pair on the machine from which you are running putty you should create one using puttygen, save the private key locally and provide the path to it in putty at Connection/SSH/Auth, then save the public key in the ~/.ssh/authorized_keys file of the machine to which you are connecting with putty. Then you need to save the public key of this machine (probably at ~/.ssh/id_rsa.pub) in the ~/.ssh/authorized_keys file of the user & machine to which it connects to run scp.

  • Thanks for quick response, and am not having rsa to use so can use please suggest more, I used the same script to copy the file from one server to another server but that time it is not asking for password but where as am trying to copy to different server it is asking for password... example: am working in server 1 i need to copy the files to server 2 and server 3 .. for server2 it not asking for password where as for server it is asking for passsword.
    – sindhu
    Nov 25, 2015 at 7:01
  • if you are not using some other security mechanism, any machine should ask for a password when you connect with scp, if it doesn't then its security is seriously lacking.
    – gogoud
    Nov 25, 2015 at 7:05
  • can you suggest how to write the command to pass the password in putty
    – sindhu
    Nov 25, 2015 at 7:12
  • to do this 'properly' you use another piece of software by the same guy called pageant - available at chiark.greenend.org.uk/~sgtatham/putty/download.html. But also see superuser.com/questions/44106/….
    – gogoud
    Nov 25, 2015 at 7:14
  • ok Thank you :) so in shell script we can't pass the password right ...
    – sindhu
    Nov 25, 2015 at 7:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .