Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Logged into remote server with key but can't upload file with scp

Writer Matthew Martinez

New to Ubuntu, I logged into my institution's remote server having generated a private/public key pair. I was set up with a username after sending the administrator the public key. I should have been able to log in by using ssh myusername@servername but I can only log in if I replace the servername with the IP address, ssh

Now, wanting to upload a file I tried:

scp ~/myfile.rds myusername@servername:/home/myusername/

...which got me a Permission denied (publickey). lost connection message. The administrator suggested trying again, replacing servername with the IP address. That makes sense, but still the same response.

My config file, saved at \\wsl$\Ubuntu\home\myUbuntuUsername\.ssh along with the two keys, reads:

Host servername HostName xxx.xx.x.xx Port 22 User myusername IdentityFile ~/.ssh/id_ed25519

...where ~/.ssh/id_ed25519 is the path to the private key. What could I have got wrong?

3

1 Answer

Specifying the username in your ssh and scp commands shouldn’t be necessary, as the value is already in your ~/.ssh/config file. Instead, you can do this:

ssh servername

For scp it’s the same:

scp myfile.gz servername:/path/to/save

Alternatively, you can pass the key file to use with -i:

scp -i ~/.ssh/id_ed25519 myfile.gz user@123.123.123.123:/path/to/save
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy