liunx centox ssh 配置

https://www.cnblogs.com/xubing-613/p/6844564.html

一. 查看是否安装了ssh: rpm -qa | grep ssh

重启ssh  service sshd restart

开启 sshservice sshd start

二..

修改/etc/ssh/sshd_config配置

PermitRootLogin no //允许root 登录 no 则反之
UsePAM no
PasswordAuthentication no  //禁止远程用密码登录
RSAAuthentication yes
PubkeyAuthentication yes  // 启用公钥验证

三.重启ssh   service sshd restart

四.设置liunx系统的用户密码

步骤:

1: 登录服务器,切换到root用户,命令:sudo su
2: 修改ssh配置文件,命令: vim /etc/ssh/sshd_config
修改下面两个参数把no改为yes
PermitRootLogin no
PasswordAuthentication no
3: 重启ssh服务使修改生效,
debain命令:/etc/init.d/ssh restart
centos命令:service sshd restart
4: 给root账户添加密码,
命令:passwd root
输入命令后会让你设置密码,输入两次要设置的密码

五.登陆
 由于root已被禁用,只能先用普通用户登陆,然后切换会root

猜你喜欢

转载自www.cnblogs.com/jiangfeilong/p/10373998.html