CentOS7配置SSH远程登录

确保已经开启静态IP

开启ssh服务需要root权限,先用root账户登陆

先检查有没有安装ssh服务:rpm -qa | grep ssh

如果没有安装ssh服务就安装 :

#yum install openssh-server

安装 openssh-server
#yum install -y openssl openssh-server

修改配置文件

安装好后在ssh配置文件里进行配置 :

#vim /etc/ssh/sshd_config

打开22端口(此处可以自定义,默认22)

允许root账户登录

PermitRootLogin no //阻止root用户登陆
AllowUsers newusername //允许制定用户使用SSH登陆
PasswordAuthentication no //阻止用户密码SSH登陆⚠️如果设置no,证书还没配置对,你就登陆不上了
 

启动ssh服务
#systemctl start sshd.service

这个命令没有回显

开启后用 ps -e | grep sshd 检查一下ssh服务是否开启

再用netstat -an | grep 22检查一下22端口是否开启

重启网络
service network restart

设置开机启动ssh服务
systemctl enable sshd.service

 

参考文章

https://blog.csdn.net/baibaigao/article/details/80956417

http://blog.sina.com.cn/s/blog_5f1616150102xl5h.html

https://www.cnblogs.com/gispathfinder/p/8833300.html

https://blog.csdn.net/crazy018/article/details/79948610

posted on 2019-09-30 11:44  我找的就是你  阅读(9685)  评论(0编辑  收藏  举报

导航