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