Install and configure an SSH server in CentOS
SSH is the default protocol for Linux Remote Management. SSH is one of the most important software installed and running on the minimal CentOS server.
Check the installed SSH version.
# SSH-V
Check the SSH Version
Use a safer SSH protocol instead of the default protocol, and change the port number to further enhance security. Edit the SSH configuration file '/etc/ssh/ssh_config '.
Remove the comment in the following line or delete 1 from the Protocol line, and then the line looks like this (LCTT: SSH v1 is an out-of-date insecure protocol ):
# Protocol 2, 1 (originally)
Protocol 2 (now)
This change forces SSH to use Protocol 2, which is considered safer than Protocol 1, and also ensures that the port number 22 is changed to another in the configuration.
Protect SSH Login
Cancel the 'root login' in SSH. You can use the su to switch to the root account only after logging on with a common user account. This further enhances security. Open and edit the configuration file '/etc/ssh/sshd_config' and change PermitRootLogin yes to PermitRootLogin no.
# PermitRootLogin yes (originally)
PermitRootLogin no (now)
Cancel SSH Root Login
Finally, restart the SSH service to enable the changes.
# Systemctl restart sshd. service