ssh服务搭建
关闭防火墙与selinuxsystem
systemctl status firewalld.service (查看防火墙状态)
systemctl stop firewalld.service (临时关闭)
systemctl disable firewalld(关闭开机自启)
getenforce (查看selinux状态)
setenforce 0 (临时关闭selinux)
vim /etc/selinux/config (编辑selinux配置文件)
SELINUX=disable (修改选项,永久关闭)
或者sed -i “s/SELINUX=enforcing/SELINUX=disabled/” /etc/selinux/config;(永久关闭)
配置yum源并安装
一般现在都自带ssh,安装个毛,省略
systemctl restart sshd
查看状态
systemctl status sshd
进程查看方式
ps aux |grep sshd
端口查看方式
netstat -lntp|grep sshd
开启自启动
systemctl enable sshd
禁止远程root用户登录
修改配置文件 vim /etc/ssh/sshd_config
打开文件第38行 修改以下内容
#PermitRootLogin yes
PermitRootLogin no