I want to run scp command from my machine(Ubuntu_14) to my server (CentOS_6)
I have already generate a pair of authentication keys, also append my public key to my servers .ssh/authorized_keys, now I can run ssh command from my machine to my server without password, but when I am going to run scp command it asking for password
Please help me..
12 Answers
Since you can ssh to the server only with your key, you can scp with the key too - just make sure to point it with scp -i /path/to/private_key <source> <target>.
You can also use an ssh-agent program - you won't have to use the -i keyfile switch everytime (this applies for ssh too). Start it with:
ssh-agent bash
ssh-add -L #this lists the keys you have added (the public key)
ssh-add /path/to/private_key #this will add a key 7 Once you set up ssh-keygen as explained here, you can do
scp -i ~/.ssh/id_rsa /local/path/to/file :/path/in/remote/server/
where id_rsa is the local key generated in the ssh-keygen setup.
If you want to lessen typing each time, you can modify your .bash_profile file and put
alias remote_scp='scp -i ~/.ssh/id_rsa /local/path/to/file :/path/in/remote/server/Then from your terminal do source ~/.bash_profile. Afterwards if you type remote_scp in your terminal it should run the scp command without password.