先检查有没有安装ssh服务:
rpm -qa | grep ssh
如果没有安装ssh服务就安装:
yum install openssh-server
安装好后在ssh配置文件里进行配置 :
vim /etc/ssh/sshd_config
Port 22
PermitRootLogin yes
配置好后
先按esc (退出编辑)
再按shift + :
再输入wq(也就是保存退出的意思)
最后按enter
开启ssh服务:
/bin/systemctl start sshd.service
检查ssh服务是否开启:
ps -e | grep sshd
或
systemctl status sshd.service
检查端口是否开启:
netstat -an | grep 22
将ssh服务添加到自启动列表中:
systemctl enable sshd.service