Skip to main content
edited tags
Link
Jeff Schaller
  • 68.9k
  • 35
  • 122
  • 267
Source Link

How to create a new user with ssh access?

I am trying to set up a new user on my remote server.

I have created a new user with sudo access.

adduser username
usermod -aG sudo username

Then in the /etc/ssh/sshd_config file I have allowed that user ssh access.

AllowUsers username root

and I restarted ssh.

service sshd reload

Finally I logged in as the user and copied my public ssh key into the ~/.ssh/authorized_keys file.

But I still get Permission denied (publickey) when I try to ssh as that user.

ssh [email protected]

I am able to ssh as the root user with no problems.

ssh [email protected]

Am I missing something?