Setting up a CentOS 7 cloud server for a client, and have run into an issue with setting it to use a public RSA key instead of a password for one of a handful of SFTP users.
Found an online guide on setting up keys at:
https://debian-administration.org/article/530/SSH_with_authentication_key_instead_of_password
The client supplied a public key file, which I copied to the server using the "ssh-copy-id" command. All good according to the responses I got.
I then locked the account using the "passwd -l" command. Reset the server and checked, and the system confirms that the password is locked:
testuser1 LK 2018-09-17 0 99999 7 -1 (Password locked.)
However, I can still log in using a password using that account on computers that do not have the private key installed.
So, I did more research, and found another tutorial that says you can force the use of RSA keys by setting PasswordAuthentication to no in the etc/ssh/sshd_config file, which raises a concern as other users do not use RSA keys for their login.
Did I do something wrong, or is there something else I can do to disable passwords for this single account? Is there a way to allow some users to use passwords while allowing others to use a RSA key?
sudo passwd -l <username>
should have worked. Check there are no typos and that sort of thing.However, I can still log in using a password using that account on computers that do not have the private key installed.
Do you mean that you locked the password on all these other computers, or did you just lock it on one host and expect it to be locked everywhere?