A have a remote server for which I want to disable remote login using a password for root and other users. I have gone through a few articles on the Internet about how to do that and I have the following list of things to do/change:
create private key authentication using SSH keys for all users ( I have already done this )
Set the following settings in
sshd_config:set
PermitRootLogin without-passwordset
ChallengeResponseAuthentication noset
PasswordAuthentication noset
UsePAM noset
AllowUsers root otheruser
restart
sshusingsudo service ssh reload
However, I am not sure exactly which changes are to be made to the sshd_config file and I don't want to be locked out of my remote server.
If I want to be able to login as root and other users using only SSH keys, what changes do I make?
If I want to prevent remote root login at all what changes do I make (and how much more secure it is as compared to remote root login using SSH keys)?
If I prevent remote root login at all by making changes to sshd_config file, how will I ever be able to login as ROOT if I want to in future?
Please answer these questions as explicitly as possible and pardon me for lack of trying things as I am completely horrified of the possibility of getting locked out of my own remote server.