Do you want to configure direct root login is allowed to a specific set of ip address, there are two way configure in your sshd_config file.
Note: The following configuration disabled direct root login and allow specific users and IP only,
open the ssh configure file /etc/ssh/sshd_config
# vim /etc/ssh/sshd_config
The below configurations are disabled direct root login except Match address (192.168.0.20) with users,
#LoginGraceTime 2m
PermitRootLogin no
AllowUsers username root
#Allow direct root login specific IP
Match address 192.168.0.20
PermitRootLogin yes
Match user root
PubkeyAuthentication no
PermitRootLogin no
AllowUsers username root
#Allow direct root login specific IP
Match address 192.168.0.20
PermitRootLogin yes
Match user root
PubkeyAuthentication no
Finally, restart your ssh services.
# services sshd restart
Comments (0)