修改的是 /etc/ssh/sshd_config 文件
01 | [root@linux ~] # vi /etc/ssh/sshd_config |
02 | # $OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp $ |
03 | # This is the sshd server system-wide configuration file. See |
04 | # sshd_config(5) for more information. |
05 | # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin |
06 | # The strategy used for options in the default sshd_config shipped with |
07 | # OpenSSH is to specify options with their default value where |
08 | # possible, but leave them commented. Uncommented options change a |
09 | # default value. |
10 | Port 8284 //以前这个前面是有 # 号的,而且默认是 22 ,修改一下就ok了 |
11 | #Protocol 2,1 |
12 | #ListenAddress 0.0.0.0 |
13 | #ListenAddress :: |
14 | # HostKey for protocol version 1 |
15 | #HostKey /etc/ssh/ssh_host_key |
16 | # HostKeys for protocol version 2 |
17 | #HostKey /etc/ssh/ssh_host_rsa_key |
18 | #HostKey /etc/ssh/ssh_host_dsa_key |
重起ssh服务,修改端口才生效
1 | [root@linux ~] # /etc/init.d/sshd restart |
2 | Stopping sshd: [ OK ] |
3 | Starting sshd: [ OK ] |
4 | [root@linux ~] # |
为了检验是否正确,可以使用 netstat -an 命令查看一下。