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
posted @ 2019-02-14 12:51  江期玉  阅读(175)  评论(0编辑  收藏  举报