I have a public and private key in X:\secure. Straight ssh with the private key works and I connect okay:
ssh -i X:\secure\id_rsa The remote server is all set up for ssh and has the public key from X:\secure\id_rsa.pub added to /etc/ssh/authorized_keys/remoteuser.
However, when I try to send a file over using
scp somefile.txt -i X:\secure\id_rsa :~I get prompted for password.
Question: Is there a way to scp a file over seamlessly, without a prompt, just like ssh connection is established using a private key?
23 Answers
i am on linux so i can not test this but have you tried:
scp -i X:\secure\id_rsa somefile.txt :~
i'm pretty sure you have to put the options before the source file. if you're getting a password prompt then the key is not being sent.
I'm on a Winows 10 machine, connecting to a Ubuntu server. I've set it up so that I can only connect with a private key with a passphrase.
I'm using cmder and this works in Windows:
scp -i ~\.ssh\privatekey foobar.txt linuxuser@server:/home/linuxuser~.ssh\ referes to C:\Users\.ssh\
Just giving my scenario as an answer here , any future readers may get benefited . File copied from Windows system to the Amazon EC2 instance running in Ubuntu.
C:\Users>scp -i "C:\aws\keys\JenkinsSrv.pem" jenkins-cli.jar :/home/ubuntu