3

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 [email protected]

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 [email protected]:~

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?

2
  • Are you prompted for the account password, or the SSH key passphrase? Commented Oct 25, 2017 at 20:26
  • account password
    – amphibient
    Commented Oct 25, 2017 at 20:39

3 Answers 3

2

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\

1
  • I found PuTTY's openssh format works fine for the private key, although .ppk does not.
    – Wassadamo
    Commented Feb 1, 2023 at 4:56
1

i am on linux so i can not test this but have you tried:

scp -i X:\secure\id_rsa somefile.txt [email protected]:~

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.

0

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 [email protected]:/home/ubuntu
     

                                                                

You must log in to answer this question.

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