How to Disable Root SSH Access on CentOS 7
First, create an alternate user instead of using the default "root" useradd doneill Second, set a password for this user passwd doneill Third, give sudo permission for this user. For that go this file visudo Add permission to your user like this. Here the user name is doneill Now check whether you can run the sudo command with username as doneill su doneill sudo ls If things work good, continue Now prevent SSH login as root user. vi /etc/ssh/sshd_config Search for "Permit" word to Now restart your ssh service by below command service sshd restart Thats it. Now please check what you have done is working fine. Don't logout now, first make sure everything is working fine. type ssh doneill@your systemip and give the password and check if the user login works fine.