Centos7 can not use ssh landing and solutions

View status:

systemctl status sshd.service

Start the service:

systemctl start sshd.service

Restart the service:

systemctl restart sshd.service

Boot from Kai:

systemctl enable sshd.service







Today, the project team to reflect, there is not a Centos7 server using SSH landing, so I logged on to the system through a local, we found SSH service does not start, the determination method is mainly used netstat method for viewing;

1
netstat  -anlpt |  grep  22

Speaking after this, if it is Centos7 words, if we want to use the netstat command, then you need to install net-tools can be used

1
yum instatll net-tools –y    ----安装 netstat 工具

Try to manually start the sshd service fails to start, an error (22 port is not listening)

clip_image001

Centos7 under ssh not independent log log, so the message at

1
Tail –f  /var/log/message      /usr/sbin/ 缺少sshd的文件

clip_image002

1
Cd  /usr/sbin/ 下确实没有提示中的sshd文件或者目录

clip_image003

So we need to re-install it

1
yum reinstall openssh-server

clip_image004

The installation is complete

clip_image005

After the installation files have ssh file information

clip_image006

Files can restart sshd

1
systemctl start sshd ---启动sshd服务

clip_image007





Guess you like

Origin www.cnblogs.com/dzcWeb/p/11125579.html