默認情況是,CentOS的sshd服務是開啓的,但是需要我們修改一下相關的配置文件。
這裏介紹CentOS配置ssh安裝設置使用,幫助大家安裝更新CentOS配置ssh系統。絕大部分內容適用於CentOS /RHEL ,同時也適用於其他發行版本。
1.在hosts.deny文件尾添加CentOS配置ssh:ALL意思是拒絕所有訪問請求
[root@localhost ~]# vi /etc/hosts.deny修改後看起來如下:
#hosts.denyThis file describes the names of the hyusaosts 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
2.在hosts.allow文件尾添加CentOS配置ssh:192.168.0.
意思是允許192.168.0.1 到254的主機,內網。
[root@localhost ~]# vi /etc/hosts.allow
#
# 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.0.
3.重啓CentOS配置ssh
[root@localhost ~]# /etc/rc.d/init.d/sshd restart
停止 ssh [ 確定 ]
啓動 ssh [ 確定 ]
這樣,就可以遠程登錄主機,進行其它相關配置了。