0

I connect to my DigitalOcean droplet (linux CentOS server) through SSH with root user. It's workin fine without any problem. But when I try to connect to my server through second non root user it gives me an error:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

This is my steps to setup access for second user:

  • adduser seconduser - create second user on Server (the name of a new user is the same as the name of a user on my local Mac)
  • sudo su - seconduser - switch to new user
  • cd ~ - go to home dir
  • mkdir .ssh - create new .ssh
  • chmod 700 .ssh - setup rwe permission for dir
  • touch .ssh/authorized_keys - create file
  • chmod 600 .ssh/authorized_keys - setup rw permission for open key file
  • cat .ssh/id_rsa.pub - copy my open key from my local mac
  • vim .ssh/authorized_keys - paste it in file on server

Then I try to connect, like this:

  • ssh seconduser@111.111.111.111

and it gives me an error.

I tried to solve it by changing ssh folder from home\ to etc\ like in this answer:https://ubuntuforums.org/showthread.php?t=1932058 but it doesn't help.

Also I double check my open key (it's the same and root is workin with this key).

Also I checked permissions on file and dir on my local Mac: ~/.ssh/id_* permissions is 600

Also I checked /etc/ssh/sshd_config file. There are:

RSAAuthentication yes

PubkeyAuthentication yes

So, what have I doing wrong? It's my second day with this trouble. Please help!

  • Check /var/log/auth.log, it may give you clues. – LawrenceC Aug 13 '18 at 18:51
  • 1
    You forgot to add option -i /path/to/your/private.key in ssh command – Alex Aug 13 '18 at 22:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.