Question

SSH permission Denied

Hi

2 weeks ago I format my pc to ubuntu 17.10.Then I try to log in my server but it refuses.

  • I create rsa keyin my pc. and put it from droplet panel first but it refuses again (permission denied) then tried DO ssh setting (how to use ssh key) , it refuses again
  • I changed ssh_config, add password authentication pubkey auth, rsa auth, it refuses permision denied
  • I remove .ssh folder from root and user in droplet, it refuses again

output /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 2 key(s) remain to be installed – if you are prompted now it is to install the new keys Permission denied (publickey).

or

debug1: Offering RSA public key: /home/selo/.ssh/id_rsa debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey debug1: Offering RSA public key: /home/selo/.ssh/id_rsa debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey debug1: Trying private key: /home/selo/.ssh/id_dsa debug3: no such identity: /home/selo/.ssh/id_dsa: No such file or directory debug1: Trying private key: /home/selo/.ssh/id_ecdsa debug3: no such identity: /home/selo/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: /home/selo/.ssh/id_ed25519 debug3: no such identity: /home/selo/.ssh/id_ed25519: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey).

what must I do?

note: I read all question about ssh in do

thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This worked for me:

chmod go-w ~/ chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys

https://www.howtogeek.com/168156/fixing-authentication-refused-bad-ownership-or-modes-for-directory/

DO host from droplet console root and user

chmod 700 .ssh chmod 600 .ssh/authorized_keys

copy ur pub with wget cat publickey > .ssh/authorized_key (root and user)

solved

can u write ur do and local ssh_config pls?

I create rsa keyin my pc. and put it from droplet panel first but it refuses again (permission denied) then tried DO ssh setting (how to use ssh key) , it refuses again

Adding your ssh key to your account makes it available on the droplet creation page so it can be inserted into new droplets when they are created. It is not applied to your existing droplets.

I changed ssh_config, add password authentication pubkey auth, rsa auth, it refuses permision denied

If you were attempting to switch to password authentication you will also want to make sure that AllowRootLogin is set to true unless you are using a different user.

I remove .ssh folder from root and user in droplet, it refuses again

This effectively deletes all reference on your droplet to your keys and will completely prevent any login with a key since there is no key to match it up against.

Once you’ve created your private/public keypair on your local machine this tutorial can be used to help you place it properly on your droplet. The relevant section is “How To Copy a Public Key to your Server”.