ssh root ssh localhost无需密码,但是普通用户登陆需要密码的解决办法!

来源:互联网 发布:全局优化算法 编辑:程序博客网 时间:2024/05/17 02:33

遇到此问题甚是郁闷,网上所有问题搜索遍了,都未能解决此问题,万分沮丧.

先说下别人的方法比如:

1.更改sshd_config文件中的相关属性(虽然对我没什么大的用处,不过其中谈到一点,我十分同意(个人观点),就是要关闭root)

2.更改authorized_keys的权限, chmod 600 authorized_keys;(大多数是这种权限问题,赞同)

...

上述方法对我没有任何作用,甚是难过。

最后我倒置过来倒置过去,发现是我以前改过用户的权限,将此用户的权限和root用户的权限设置成一样,问题解决了,纠结...

以此警戒自己,同时也希望能帮助到其他的童鞋....(*^__^*) 嘻嘻……

最后贴下我出现问题的log的一小部分

debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/xxx/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/xxx/.ssh/id_dsa
debug3: no such identity: /home/xxx/.ssh/id_dsa
debug1: Trying private key: /home/xxx/.ssh/id_ecdsa
debug3: no such identity: /home/xxx/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password

debug1: Next authentication method: password

其实说到底还是文件权限的问题,大家细心思考就好。

原创粉丝点击