Preparation
1. Check whether ssh is installed: rpm -q OpenSSH-server (generally comes with it, no need to install)
2. Install ssh service: yum list installed | grep openssh-server
Server side configuration
1.cd /etc/ssh
2.vim sshd_config
Port 22 is the default port number
Add the port number:
Query the current ssh service port: semanage port -l | grep ssh
Add ssh port to SELinux: semanage port -a -t ssh_port_t -p tcp port number
Verify that the ssh port is added successfully: semanage port -l | grep ssh
After the addition is successful, you can restart the ssh service: systemctl restart sshd.service
Add the modified port to the firewall: (generally close the firewall)
The command to add a port to the firewall is: firewall-cmd --zone=public --add-port=10022/tcp --permanent
reaload firewall rules: firewall-cmd --reload
Check whether the port is added successfully: firewall-cmd --zone=public --query-port=10022/tcp
Client side access works
Access from another machine:
1.ssh ip address -p port number
Modify access password: passwd username
The root user can directly use passwd and enter the new password
Well, our ssh remote login experiment is over here. If there are any mistakes in the article, please point them out. Let's make progress together!