I'm trying to create a user on a Linux box that can only log on via ssh with a key specified in authorized_keys. The user should not be able to log on via password, neither via ssh nor locally at the console. How would I do this?
Currently I do:
useradd -m myuser
passwd myuser
vi /etc/shadow
and replace the password field with '*'. There must be a better way? If I don't set the passwd first, ssh won't work either saying in the log "User myuser not allowed because account is locked"
Give them a password and don't tell them what it is.
passwd -l myuser
will effectively disable user password