Linux Administration Cookbook
上QQ阅读APP看书,第一时间看更新

Disabling passwords (force key use)

Because we've got our public keys on this host, we no longer need to allow password-based access.

Find the PasswordAuthentication line:

#PermitEmptyPasswords no
PasswordAuthentication yes

Change this line to no:

#PermitEmptyPasswords no
PasswordAuthentication no

Restart the SSH daemon:

[vagrant@centos2 ~]$ sudo systemctl restart sshd
The eagle-eyed among you will have noticed that I already flipped this setting once, in the Vagrantfile at the start of this chapter. This was to allow us to use Vagrant as a learning experience, and we are effectively reversing the reversal right now.