打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
修改SSH端口
1、最好是本机修改

2、首先查找SSH的配置文件
[root@linux ~]#find / -name ssh* -print //参数不详细解释了,自己也没记住
[root@linux ~]# find / -name ssh* -print
/usr/libexec/openssh/ssh-keysign
/usr/share/man/man8/sshd.8.gz
/usr/share/man/man8/ssh-keysign.8.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man5/ssh_config.5.gz
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man1/ssh-add.1.gz
/usr/share/man/man1/ssh.1.gz
/usr/share/man/man1/ssh-agent.1.gz
/usr/share/man/man1/ssh-keyscan.1.gz
/usr/share/doc/nss_ldap-226/pam.d/ssh
/usr/sbin/sshd
/usr/bin/ssh
/usr/bin/ssh-keygen
/usr/bin/ssh-add
/usr/bin/ssh-keyscan
/usr/bin/ssh-agent
/var/run/sshd.pid
/var/lock/subsys/sshd
/var/empty/sshd
/etc/ssh
/etc/ssh/ssh_config
/etc/ssh/ssh_host_dsa_key.pub
/etc/ssh/ssh_host_key
/etc/ssh/sshd_config
/etc/ssh/ssh_host_rsa_key.pub
/etc/ssh/ssh_host_dsa_key
/etc/ssh/ssh_host_key.pub
/etc/ssh/ssh_host_rsa_key
/etc/pam.d/sshd
/etc/log.d/scripts/services/sshd2
/etc/log.d/scripts/services/sshd
/etc/log.d/conf/services/sshd2.conf
/etc/log.d/conf/services/sshd.conf
/etc/rc.d/init.d/sshd
[root@linux ~]#

3、修改的是 /etc/ssh/sshd_config 文件,(第一次修改的是 ssh_config 文件,结果重起ssh服务,怎么没生效呢?自己还纳闷了,后来google里跑了一下,答案就出来了。
[root@linux ~]# vi /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

Port 2222 //以前这个前面是有 # 号的,而且默认是 22 ,修改一下就ok了
#Protocol 2,1
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key


4、重起ssh服务,修改端口才生效
[root@linux ~]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@linux ~]#

5、为了检验是否正确,可以使用 netstat -an 命令查看一下,在linux下的netstat命令自己也没用熟悉,咳~
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
CentOS7.x升级openssh8.4p1详解
【转载】openSSH Server 手动安装和配置
OpenSSH移植到ARM Linux教程
redhat 7.4从openssh7.6离线升级openssh8.4p1解决方法
mini2440 ssh
AIX 5.3 下安装ssh 并解决ssh下delete与backspace按键解释错误问...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服