centos7修改xshell默认访问端口由22修改为258
vim /etc/ssh/sshd_config
新加端口258:Port 258
重启sshd服务:systemctl restart sshd
提示:如果报错
for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
可以试试setenforce 0
具体原因参考该博主
将新加端口添加到防火墙并重启防火墙:
firewall-cmd --list-ports # 查看当前放通的端口
firewall-cmd --zone=public --add-port=258/tcp --permanent # 放通端口
firewall-cmd --reload # 重启防火墙后生效