Score:1

Permission denied(publickey) when I try to move local file to ubuntu

sc flag

I'm trying to move my local file to ubuntu server

scp /Users/jaeuk/Python project/MarketTimer/MarketTimer_1.1.py ubuntu@public IP:/home/ubuntu

at the first time when I do that I get this output:

The authenticity of host 'public IP (public IP)' can't be established.
ED25519 key fingerprint is SHA256:*****.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'public IP' (ED25519) to the list of known hosts.
ubuntu@public IP: Permission denied (publickey).
lost connection

and it keeps printing same output:

ubuntu@public IP: Permission denied (publickey).
lost connection
Romeo Ninov avatar
in flag
Probably you do not have rights in `/home/ubuntu`. Try to copy in `ubuntu@public_IP:`
Joshua Chung avatar
sc flag
@Romeo Ninov copy what?
Romeo Ninov avatar
in flag
Copy your file. Exec the command like `scp /Users/jaeuk/Python project/MarketTimer/MarketTimer_1.1.py ubuntu@public_IP:`
Joshua Chung avatar
sc flag
@RomeoNinov same error occured
Romeo Ninov avatar
in flag
Sorry, my mistake, the source file should be in quotes: `scp "/Users/jaeuk/Python project/MarketTimer/MarketTimer_1.1.py" ubuntu@public_IP:`
Joshua Chung avatar
sc flag
@RomeoNinov Yeah I did exactly what you said and the error occurred. I omitted quotes obove
Romeo Ninov avatar
in flag
What is the result of command: `ls -ld "/Users/jaeuk/Python project/MarketTimer/MarketTimer_1.1.py"`?
Joshua Chung avatar
sc flag
@RomeoNinov same error ` [email protected]: Permission denied (publickey) `
Score:0
cv flag

You should have verified that you are using a keys pair for the local user in your client that its publickey is allowed by the server for the user ubuntu in the /home/ubuntu/.ssh/authorized_keys file containing the public key of your local user pair of keys.

Runing the following command in your ssh client:

ssh-agent sh -c 'ssh-add; ssh-add -L'

You will get the public key file content that should be included in the /home/ubuntu/.ssh/authorized_keys file in your remote server.

If you can't access to the server you can't verify the ubuntu user authorized_keys content, so you will be able to add rebooting in rescue mode and mounting the file system with chroot or add the public key via a web dashboard of your server provider.

If you have verified that your public key setting are really ok or in any case that it still not working please run:

ssh -vvv ubuntu@public_ip

and/or

scp -vvv /Users/jaeuk/Python project/MarketTimer/MarketTimer_1.1.py ubuntu@public IP:/home/ubuntu

It should show you a lot of more useful information for know what's happening. You can paste the results for get more help about your specific case

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.