centos7修改ssh端口号(阿里云)


1.
//登录远程
ssh root@xxxx.xxxx.xxxx.xxx ls
-release -a 查看系统版本
//查看当前的ssh端口号
netstat -anlp | grep sshd

2.  vi /etc/ssh/sshd_config
修改 port  改成10022

 

yum whatprovides semanage
//反查需要的包,并安装
semanage port -a -t ssh_port_t -p tcp 10022

semanage port -d -t ssh_port_t -p tcp 27000  
//删除多余端口号

 

systemctl restart sshd , systemctl status sshd 检查服务状态,或者输入netstat -an | grep 10022  检查  10022 号端口是否开启监听

 

 

//修改阿里云的入口安全配置

 

 
 

 

 

//设置防火墙开放修改的端口
firewall-cmd --permanent --zone=public --add-port=10022/tcp
//重启firewall
firewall-cmd --reload

//查看firewall 端口号
firewall-cmd --list-ports
firewall-cmd --list-all

//提示FirewallD is not running,查看防火墙有没开 systemctl status firewalld //开启防火墙 systemctl start firewalld //重启防火漆 systemctl restart firewalld //关闭防火墙 systemctl stop firewalld


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM