To increase server security you can disable direct root login. We will create a wheel user. You will connect first with this user and then you will use the su command to switch to the root user.
The necessary steps are:
- Create a new CentOS user using the command:
- Set a password for the created user with:
- Add the user to the Wheel Group. For this, run the command:
usermod -aG wheel username
- Edit the /etc/ssh/sshd_config file:
Add the line (or modify if it is PermitRootLogin yes)
Save the file and exit the file editor.
- Restart the SSH server:
service sshd restart