centos7服务器安装并配置ssh

使用putty连接centos7服务器,失败如下

centos7服务器安装并配置ssh_第1张图片

1、检查是否安装

先进入centos7服务器看查看是否安装SSH

yum list installed | grep openssh-server

若没有没有任何东西,则输入

yum install openssh-server

2、安装后进行配置

安装后进行配置,使用vim编辑/etc/ssh/sshd_config文件。将文件中,关于监听端口、监听地址前的 # 号去除。并允许远程访问。同时开启用户名密码作为验证

centos7服务器安装并配置ssh_第2张图片

centos7服务器安装并配置ssh_第3张图片

3、开启sshd服务

systemctl enable sshd
systemctl start sshd

4、检查是否开启

systemctl status sshd
losf -i:22

5、用putty进行连接

倘若还不成功,关闭服务器防火墙

systemctl stop firewalld

再次连接就可以了

你可能感兴趣的:(linux)