SSH免密码登录配置,SSH密码登录配置


ssh免密码登录Permission denied (publickey,gssapi-keyex,gssapi-with-mic) 的解决方案

1.在hadoop目录 新建.ssh目录

使用:ssh-keygen -t rsa 生成公私钥

默认生成在、/home/user/.ssh文件中  直接复制到hadoop/.ssh文件中即可

把公钥信息写入 authorized_keys 文档中 :cat  id_rsa.pub  >>  authorized_keys

2.修改文件夹以及文件的权限。

#chmod 700 hadoop/.ssh

#chmod 644 hdoop/.ssh/authorized_keys

3.配置ssh服务器配置文件。

在root 用户下才能配置。

vim /etc/ssh/sshd_config

以下权限设为no:

PermitRootLogin no

UsePAM no

PasswordAuthentication no

以下权限设为yes:

RSAAuthentication yes

PubkeyAuthentication yes

4.重启sshd服务

sudo systemctl restart sshd.service

5.测试ssh服务

ssh+主机名

 

相关内容