我们在文件的最后面添加 SSHd:ALL 看起来像这样
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
SSHd:ALL (这个为添加部份,屏蔽来自所有的SSH连接请求)
nano /etc/hosts.allow
我们也在文件的最后加入你想允许SSH连接的IP(添加SSHd:192.168.100.)我的内部IP段为192.168.100.0/24。看起来像这样
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
SSHd:192.168.100.
我们重启SSHD,在修改完SSH的配置文件后,需要重新启动SSH服务才能使新的设置生效
/etc/init.d/sshd restart
topping sshd: [ OK ]
Starting sshd: [ OK ] ← SSH服务器重新启动成功
Enter file in which to save the key (/home/sshadmin/.ssh/id_rsa): ←(钥匙的文件名,这里保持默认直接回车)
Created directory ‘/home/sshadmin/.ssh’
Enter passphrase (empty for no passphrase): ← 输入口令
Enter same passphrase again: ← 再次输入口令
Your identification has been saved in /home/sshadmin/.ssh/id_rsa. (私钥)
Your public key has been saved in /home/sshadmin/.ssh/id_rsa.pub. (公钥)
The key fingerprint is:
tf:rs:e3:7s:28:59:5s:93:fe:33:84:01:cj:65:3b:8e
centospub@sample.sshadmin.com