前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ssh登录配置公钥后仍然需要密码登录的问题处理

ssh登录配置公钥后仍然需要密码登录的问题处理

作者头像
前Thoughtworks-杨焱
发布2021-12-07 20:50:15
1K0
发布2021-12-07 20:50:15
举报
文章被收录于专栏:杨焱的专栏杨焱的专栏

发表于2018-03-272019-01-01 作者 wind

可以执行此命令看事件:

代码语言:javascript
复制
tail -f /var/log/messages

如果看到有说不能访问 ~/.ssh/authorized_keys 这个文件的,可以尝试下修改.ssh目录的权限为700authorized_keys 文件的权限为 600

如果是 selinux 限制了访问,例如

代码语言:javascript
复制
Feb  9 16:04:20 localhost python: SELinux is preventing /usr/sbin/sshd from read access on the file authorized_keys.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that sshd should be allowed read access on the authorized_keys file by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'sshd' --raw | audit2allow -M my-sshd#012# semodule -i my-sshd.pp#012

则可以按照日志中的提示执行

代码语言:javascript
复制
ausearch -c 'sshd' --raw | audit2allow -M my-sshd
semodule -i my-sshd.pp
/sbin/restorecon -v ~/.ssh/authorized_keys
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-03-27,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档