I'm following these steps when setting up the user:
$ sudo useradd periscope -m -s /bin/false $ sudo su -s /bin/bash periscope $ mkdir ~/.ssh $ # public key gets manually input here $ cat - >> ~/.ssh/authorized_keys $ chmod 600 ~/.ssh/authorized_keys $ chmod go-w ~/ ~/.ssh
Now when I try to log into this user I'm faced with the following error in
Jun 13 18:50:21 ip-172-31-27-167 sshd: User periscope not allowed because account is locked Jun 13 18:50:21 ip-172-31-27-167 sshd: input_userauth_request: invalid user periscope [preauth]
which according to https://en.wikipedia.org/wiki/Passwd means that the user is locked from a password login (good) but could be authorized to log in with SSH, which is what I want. auth.log doesn't agree however.
The way I've fixed this before is by setting a random password for that user, ssh would work then. Doesn't feel like the right solution though, I'm not enabling (or maybe not, since it's disabled in
sshd?) a login method I am not interested in.
Another option that folks suggested was to use
sudo passwd -u periscope instead but then I get the following error:
passwd: unlocking the password would result in a passwordless account. You should set a password with usermod -p to unlock the password of this account.
Is setting a password for a user, even though I never intend on using it, unavoidable?