在/etc/ssh/sshd_config配置文件中通过:AllowUsers root,AllowUsers 参数可以限制只允许某个用户登录,我这里是只允许root登录。
/etc/ssh/sshd_config
AllowUsers root
其他用户登录会报错如下: