Linux sets a user to prohibit ssh login

Linux sets a user to prohibit ssh login

Sometimes we want to be able to prohibit a user from logging in to the system with SSH, especially on cloud servers. Maybe a user’s password is not complicated for ease of use. In order to prevent hackers from brute force cracking, we hope to prohibit the user from remote ssh login. Log in with a user name with a more complicated password and then switch to a user with a simpler password, which is more secure

edit/etc/ssh/sshd_config

Add a line at the bottom of the file

DenyUsers elasticsearch

Restart the sshdservice or restart the host for the setting to take effect

After restarting, try to log in the elasticsearchuser remotely with ssh , and find that you cannot log in. The function is implemented.

Guess you like

Origin blog.csdn.net/qq_27198345/article/details/113804743