Ubuntu下搭建hadoop出现Permission denied (publickey,password)的问题

最近在利用实验室的服务器搭建hadoop,一边看网上教程,一边动手自己搭建,发现还是容易碰到很多问题
问题来源
1. 老师在一台电脑新建了一个ubuntu虚拟机,然后配置好后直接使用克隆的方式,在本地复制了多台虚拟机。
2. 我在实验室中直接建好多台虚拟机,而且采用的是每个手动配置的方式
3. 在搭建hadoop过程中需要使用SSH的RSA认证方法使集群中的主机省去密码登录
4. 首先需要安装open-ssh服务sudo apt-get install openssh-server
5. 在本机生成密钥对`ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
6. 将公钥放到自动认证的xx文件中(我也不太懂) cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys


问题现象

  • 使用ssh登录本机没问题即ssh localhost后输入一次yes再次登录本机的时候不需要输入什么就可以登录
  • 使用ssh登录其他主机的时候需要输入主机的非root用户的密码才能连接(出现Permission denied (publickey,password).)
  • 如果无法使用ssh无密码连接其他节点的主机,那么在启动hadoop的时候会出现的输入其他主机的密码,即使正确输入也无法认证

解决办法:使用scp命令将hadoop核心主机(namenode)的authorized_keys文件放到其他主机的.ssh文件夹下,可使用命令“`scp ~/.ssh/authorized_keys aaa@ServerIP:~/.ssh/

“`注:此命令需要输入帐号aaa的密码,最好保证各个主机的用户名是aaa(相同),因为用rsa产生密钥对的时候应该是和主机的用户名有关,我也是根据<<网络安全>>这门课想出的这个问题


成功后在核心主机使用ssh 加其他主机的ip就可以实现无密码登录,然后就可以使用
start-all.sh --config xxx/xxx/hadoop-x.x.x/etc/xxx/启动了,如下图

这里写图片描述


PS:有时停止hadoop,断开主机ssh连接后(我是用x-shell连接主机的),再次启动hadoop的时候会出现下图这里写图片描述
查看其他主机的目录发现这里写图片描述
将此类型的主机使用命令ecryptfs-mount-private输入帐号的密码即可


PS:scp需要使用root用户时,无法正确认证
因为ubuntu默认下关闭了root用户的远程ssh登录,需要在远程主机的 /etc/ssh/sshd_config文件中将PermitRootLogin 改为yes(无论后面是no还是其他单词)
重启ssh服务sudo /etc/init.d/ssh restart
就可以使用scp 向远程主机的root权限下的目录下写入文件

发布了14 篇原创文章 · 获赞 11 · 访问量 4万+
展开阅读全文

mac上用ssh Permission denied (publickey,password)

03-22

日志打印如下 OpenSSH_7.3p1, LibreSSL 2.4.1 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: Applying options for * debug1: Connecting to 10.211.55.18 [10.211.55.18] port 22. debug1: Connection established. debug1: identity file /Users/Sebastian/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.3 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 10.211.55.18:22 as 'Sebastian' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:v5nU1rPqA5E3j5krl8M2xnFco/14XvBqetfcP6qfTtE debug1: Host '10.211.55.18' is known and matches the ECDSA host key. debug1: Found key in /Users/Sebastian/.ssh/known_hosts:2 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/Sebastian/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Trying private key: /Users/Sebastian/.ssh/id_dsa debug1: Trying private key: /Users/Sebastian/.ssh/id_ecdsa debug1: Trying private key: /Users/Sebastian/.ssh/id_ed25519 debug1: Next authentication method: password Sebastian@10.211.55.18's password: debug1: Authentications that can continue: publickey,password Permission denied, please try again. Sebastian@10.211.55.18's password: debug1: Authentications that can continue: publickey,password Permission denied, please try again. Sebastian@10.211.55.18's password: debug1: Authentications that can continue: publickey,password debug1: No more authentication methods to try. Permission denied (publickey,password). 在网上各种方法都试过啦 请问我该如何解决这一问题 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览