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  // 启用公钥验证

三.

(3)修改文件夹以及文件的权限。

#chmod 700 /home/Hadoop/.ssh

#chmod 644 /home/Hadoop/.ssh/authorized_keys

重启 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