centos7開啟22端口,基於ssh協議
centos7安裝完成后,默認開啟22端口
SSH 為 Secure Shell 的縮寫,由 IETF 的網絡工作小組(Network WorkingGroup)所制定;SSH 為建立在應用層和傳輸層基礎上的安全協議。SSH 是目前較可靠,專為遠程登錄會話和其他網絡服務提供安全性的協議。
1. 查看本機是否安裝ssh軟件包
[root@linuxprobe ~]# rpm -qa | grep ssh
openssh-clients-7.4p1-21.el7.x86_64
openssh-server-7.4p1-21.el7.x86_64
libssh2-1.8.0-3.el7.x86_64
openssh-7.4p1-21.el7.x86_64
#如果沒有,則需要安裝
[root@localhost /]# yum install openssh-server
2.開啟SSH服務
[root@linuxprobe ~]# systemctl start sshd.service
3.查看TCP22端口是否打開
[root@localhost ~]# netstat -ntpl | grep 22
如果你在客戶端不能連接SSH服務的話,那可能是防火牆的原因,終端命令行中輸入 iptables -nL 來看是否開放了ssh tcp 22 端口:
[root@localhost ~]# iptables -nL
你可以將防火牆中的規則條目清除掉:
[root@localhost ~]# iptables -F