平时自己的本地Linux可能不需要配制SSH端口,但是在服务器的SSH端口为了安全起见,就不得不配制了,目前我接触过的发行版本(Ubuntu CenterOS)只要是安装了SSH服务的,都是在/etc/ssh/sshd_config文件当中进行配制;
如我家里的Ubuntu的如下图:
-
下面的是SSH软件目录
-
drwxr-xr-x 2 root root 4096 5月 29 13:26 .
-
drwxr-xr-x 141 root root 12288 5月 30 11:13 ..
-
-rw-r--r-- 1 root root 300261 4月 16 13:18 moduli
-
-rw-r--r-- 1 root root 1756 4月 16 13:18 ssh_config
-
-rw-r--r-- 1 root root 2542 5月 29 13:26 sshd_config
-
-rw------- 1 root root 668 5月 29 13:26 ssh_host_dsa_key
-
-rw-r--r-- 1 root root 618 5月 29 13:26 ssh_host_dsa_key.pub
-
-rw------- 1 root root 227 5月 29 13:26 ssh_host_ecdsa_key
-
-rw-r--r-- 1 root root 190 5月 29 13:26 ssh_host_ecdsa_key.pub
-
-rw------- 1 root root 419 5月 29 13:26 ssh_host_ed25519_key
-
-rw-r--r-- 1 root root 110 5月 29 13:26 ssh_host_ed25519_key.pub
-
-rw------- 1 root root 1675 5月 29 13:26 ssh_host_rsa_key
-
-rw-r--r-- 1 root root 410 5月 29 13:26 ssh_host_rsa_key.pub
-
-rw-r--r-- 1 root root 338 5月 29 13:26 ssh_import_id
-
barneyx@barneyx-virtual-machine:/etc/ssh$ vim sshd_config
-
-
# Package generated configuration file
-
# See the sshd_config(5) manpage for details
-
-
# What ports, IPs and protocols we listen for
-
Port 22 #这里就是默认的SSH服务端口号
-
# Use these options to restrict which interfaces/protocols sshd will bind to
-
#ListenAddress ::
-
#ListenAddress 0.0.0.0
-
Protocol 2
-
# HostKeys for protocol version 2
-
HostKey /etc/ssh/ssh_host_rsa_key
-
HostKey /etc/ssh/ssh_host_dsa_key
-
HostKey /etc/ssh/ssh_host_ecdsa_key
-
HostKey /etc/ssh/ssh_host_ed25519_key
-
#Privilege Separation is turned on for security
-
UsePrivilegeSeparation yes
-
-
# Lifetime and size of ephemeral version 1 server key
-
KeyRegenerationInterval 3600
-
ServerKeyBits 1024
-
-
# Logging
-
SyslogFacility AUTH
-
LogLevel INFO
-
-
# Authentication:
-
LoginGraceTime 120
-
PermitRootLogin prohibit-password
-
StrictModes yes
-
-
RSAAuthentication yes
-
PubkeyAuthentication yes
-
#AuthorizedKeysFile %h/.ssh/authorized_keys
修改完成后,直接重启一下计算机,如果防火墙开启了,配制放行这个端口号-不然可能.........
阅读(888) | 评论(0) | 转发(0) |