Install OpenSSH Server CentOS 7: Step-by-Step Guide
To install and configure the OpenSSH server in CentOS 7, follow these steps:
- Install the OpenSSH server using the yum package manager.
sudo yum install openssh-server
- Start the OpenSSH server and configure it to start automatically on boot.
sudo systemctl start sshd
sudo systemctl enable sshd
- Set up the firewall to allow SSH connections (if the firewall is enabled).
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
- Ensure that the following configuration options in the SSH server configuration file (/etc/ssh/sshd_config) are configured correctly:
Port 22 #设置SSH端口,默认为22
PermitRootLogin no #禁止root用户登录
PasswordAuthentication yes #允许密码验证登录
- Reload the SSH server configuration to apply the changes.
sudo systemctl reload sshd
Now, the OpenSSH server has been installed and configured, so you can connect to the CentOS7 server using an SSH client.