侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

sshd修改端口后无法远程连接linux

2023-12-05 星期二 / 0 评论 / 0 点赞 / 66 阅读 / 2858 字

修改ssh端口后无法连接ssh了 vi/etc/ssh/sshd_config Thisisthesshdserversystem-wideconfigurationfile.See #sshd

修改ssh端口后无法连接ssh了

vi /etc/ssh/sshd_config

  1. This is the sshd server system-wide configuration file.  See  
  2. # sshd_config(5) for more information.  
  3.   
  4. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin  
  5.   
  6. # The strategy used for options in the default sshd_config shipped with  
  7. # OpenSSH is to specify options with their default value where  
  8. # possible, but leave them commented.  Uncommented options change a  
  9. # default value.  
  10.   
  11. Port  20010  //以前这个前面是有 # 号的,而且默认是 22 ,修改一下就ok了  
  12. #AddressFamily any  
  13. #ListenAddress 0.0.0.0  
  14. #ListenAddress ::  
  15.   
  16. # Disable legacy (protocol version 1) support in the server for new  
  17. # installations. In future the default will change to require explicit  
  18. # activation of protocol 1  
  19. Protocol 2  

重起ssh服务,修改端口才生效

  1. /etc/rc.d/init.d/sshd restart  
  2. 停止 sshd:                                                [确定]  
  3. 正在启动 sshd:                                            [确定] 

修改/etc/sysconfig/iptables文件,增加如下一行:

  1. -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT  

重启        iptables

service iptables restart   

 

广告 广告

评论区