1)ssh远程登陆服务器,输入命令ll /etc/ssh/sshd_config查看配置文件
2)修改端口命令
vi /etc/ssh/sshd_config进入编辑界面,找到#port22这一行,按i键进行编辑,把#删除然后把22改成想要的端口号,然后按esc键,再输入:wq保存退出;

3)重启ssh命令(重要)
service sshd restart,成功会显示提示OK;
4)查看远程端口是否监听状态,输入命令
netstat -antl | grep (端口号)
lsof -i:(端口号)
网友评论