On a remote server I want to create a normal user and ONLY allow access via a key but I do NOT want to create the account with a password first and then disable password access later. In my admin account on the remote server I have done the following:
sudo adduser --disabled-password normaluser
Trying to connect as 'normaluser' is rejected, as desired with:
normaluser@server: Permission denied (publickey)
According to adduser
man page:
The --disabled-password option will not set a password, but login is still possible (for example with SSH RSA keys).
Not being sure how ssh keys should be generated in this instance, I sudo su
to the normaluser
account and generated keys using ssh-keygen
.
I've then tried to use the public and the private key file (copied to my local machine) to then ssh into the remote machine as normaluser
, specifying the appropriate key file with ssh -i
but I am still getting access denied (publickey)