is it possible to have a user account in Linux that can only login through its SSH public key?
I thought to simply do sudo passwd -l myuser
and lock the account (so I don't need to generate some random and secure password) and allow to login only through SSH public key. Unfortunately this does not work (log says: User myuser not allowed because account is locked).
Thanks
Just generate a random string and pass it to the
useradd
command. If nothing else,useradd -p '*NP*' <userid>
will do the trick.