修改sshd_config文件,命令为:
vim /etc/ssh/sshd_config
或者
leafpad /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
二、启动SSH服务
命令为:
方法一:/etc/init.d/ssh start
方法二:service ssh start
三、查看SSH服务状态是否正常运行,命令为:
方法一:/etc/init.d/ssh status
方法二:service ssh status
方法三:ps -ef | grep ssh //显示所有命令,连带命令行
UID PID PPID C STIME TTY TIME CMD
root 77185 53760 0 18:52 ? 00:00:00 grep --color=auto ssh
如果只是有:ssh-agent说明没有启动server
ps详解:https://www.jianshu.com/p/a122905ed002
rpm -qa | grep ssh 可以看到系统中ssh安装包
四、设置系统自动启动SSH服务
方法一:
sysv-rc-conf
sysv-rc-conf --list | grep ssh
sysv-rc-conf ssh on //系统自动启动SSH服务
sysv-rc-conf ssh off // 关闭系统自动启动SSH服务
方法二:
update-rc.d ssh enable //系统自动启动SSH服务
update-rc.d ssh disabled // 关闭系统自动启动SSH服务
方法三:
1 [root@rhel7 ~]# systemctl stop firewalld.service
2 [root@rhel7 ~]# systemctl disable firewalld.service
3 [root@rhel7 ~]# systemctl status firewalld.service
参考:https://www.cnblogs.com/itlyh/p/6045930.html