被访问端需要进行以下一些设置:
Ubuntu
setenforce 0
service sshd stop
systemctl start firewalld
firewall-cmd --add-port=2222/tcp --zone=public --permanent
firewall-cmd --reload
systemctl stop firewalld
service sshd restart
CentOS7
setenforce 0
service sshd stop
systemctl start firewalld
firewall-cmd --add-port=2222/tcp --zone=public --permanent
firewall-cmd --reload
systemctl stop firewalld
vi /etc/ssh/sshd_config
将上述文件中的Port改为2222
service sshd restart
连接
ssh root@root@192.168.156.100 -p 2222
如果是不更改端口的连接:
ssh root@root@192.168.156.100