I have a vps running debian that I can access as root over ssh. I would like to set up a user account to allow ssh access. I ssh'd in as root, created a user:
useradd -m user
created a password for the user:
and added this user to /etc/ssh/sshd_config file:
Then on my local machine, I created a key:
ssh-keygen -t rsa -b 4096 -C "user"
On the vps, I created the file /home/user/.ssh/authorized_keys
and pasted in the public key.
But I am unable to ssh in as user:
$ ssh user@vpshost user@vpshost: Permission denied (publickey). $
What am I doing wrong? I have read in a few places that I need to restart the ssh service (other places say it is not necessary), but since my only access to the vps is via ssh, and I have read that you cannot restart ssh while on ssh (which makes sense), I wonder if this is the problem.