目录
1. ssh配置及随机启动
2. 讲解使用中遇到的问题
一、 ssh配置及随机启动
1. 找到了 /etc/ssh/ 目录下的sshd服务配置文件 sshd_config,用Vim编辑器打开
将文件中,关于监听端口、监听地址前的 # 号去除。
2、设置开机启动
systemctl enable sshd
或者 [root@localhost ~]# vi /etc/rc.local 加入:service sshd start 或 /etc/init.d/sshd start
3. 启动:
systemctl start sshd
4. 查看启动状态:
systemctl status sshd
看到 Active: active (running) 即使 运行当中。
5. 看下这个ssh服务的网络连接情况:
netstat -ntlp
如果看到如下内容:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
这说明sshd已经能够正常工作了
6. 查看ssh服务有没有运行,如果有,可以看到类似以下内容:
ps -ef | grep ssh
root 2659 1 0 18:31 ? 00:00:00 /usr/sbin/sshd
root 2702 2618 0 18:38 pts/0 00:00:00 grep ssh
二、关闭防火墙
1. 查看防火墙状态
systemctl status firewalld.service
2. 停止firewall
systemctl stop firewalld.service
3. 禁止firewall开机启动
systemctl disable firewalld.service