免密码ssh设置

来源:互联网 发布:淘宝怎么上首页 编辑:程序博客网 时间:2024/04/30 09:45

hadoop设置:

免密码ssh设置

现在确认能否不输入口令就用ssh登录localhost:
$ ssh localhost

如果不输入口令就无法用ssh登陆localhost,执行下面的命令:
$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

试了一下还是不行,看看log,究竟是哪里的问题

运行命令
[root@localhost ~]tail /var/log/secure
Authentication refused: bad ownership or modes for directory /root
看来是文件权限的问题
2.google一下,发现权限很重要
~/.ssh需要是700权限
authorized_keys需要是644权限


重新设置一下权限

[root@localhost ~]cd ..
[root@localhost /]chmod 700 root
[root@localhost /]cd 
[root@localhost ~]chmod 700 .ssh
[root@localhost ~]cd .ssh
[root@localhost .ssh]chmod 644 authorized_keys


然后再试,ok了

原创粉丝点击