前提 已经安装 ssh,(查看是否安装 rpm -qa|grep ssh )
vim /etc/ssh/sshd_config
修改如下内容:
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
1、去掉注释‘#’,改为Port22。打开22端口
2、去掉注释‘#’,改为PermitRootLogin no,(默认yes允许root用户登陆,不是很安全,所以改为no ,然后新建普通用户,用普通用户的登陆)
启动sshd : /bin/systemctl start sshd.service
查看sshd启动状态 : ps -e|grep sshd
查看端口情况: netstat -an|grep 22
可以开始远程连接了, ssh zhanghao@192.168.100.10
password:#######