Sample Header Ad - 728x90

How to generate keys after creating user with adduser --disabled-password

1 vote
1 answer
186 views
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)
Asked by D-Dá´™um (197 rep)
Aug 11, 2022, 01:49 PM
Last activity: Aug 11, 2022, 01:59 PM