- 弄了很久
几篇教程
问题与解决
问:伪分布环境配置的时候,启动Hadoop时提示输入root的密码,但是无论如何也无法输入正确。(本人参考很良心的中文版教程进行的配置)
$ sudo /usr/local/hadoop/sbin/start-dfs.sh
Starting namenodes on [localhost]
root@localhost's password:
root@localhost's password: localhost: Permission denied, please try again.
答:首先发现我用了sudo,所以提示需要输入的密码是root的
1.Ubuntu默认的root密码似乎是随机的,如果没有更改过那么无论你怎么输入也不对。故需要修改root密码。
$sudo passwd root
2.但是改了之后,原本无法su root成功,修改后可以成功su root,证明我的root密码已经的确修改成我设置的密码了,但是对于root@localhost’s password:还是没办法怎么办:修改ssh的配置文件
$sudo gedit /etc/ssh/sshd_config
1) PasswordAuthentication yes
2) PermitRootLogin yes
3) RSAAuthentication yes
4) PubkeyAuthentication yes
5) AuthorizedKeysFile %h/.ssh/authorized_keys
- 尤其是(2)的PermitRootLogin,在我找遍了谷歌百度也无解的时候,我确信问题出在ssh身上,于是查看了ssh的日志记录
$ cat /var/log/auth.log | grep ssh
- 注意,文件名不一定是auth.log,路径也不一定百分百匹配,因为我看一篇文章上是ta的日志在别处叫别的名字,总之实在/var/log这里面,找一找就能找到
Feb 23 23:07:33 niugenen sshd[6429]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=127.0.0.1 user=root
Feb 23 23:07:40 niugenen sshd[6429]: Failed password for root from 127.0.0.1 port 43132 ssh2
Feb 23 23