SELINUX导致的SSH密匙无法创建和访问的问题

故障现象:
执行生成密匙命令时提示:
#ssh-keygen -t dsa
......
open /root/.ssh/id_dsa failed: Permission denied.
Saving the key failed: /root/.ssh/id_dsa.

同时:
放置好其他机器的authorized_keys,也无法通过密匙访问,任然需要密码。
Connection to 192.168.X.X closed.
[root@hadoop-0 .ssh]# ssh 192.168.X.X
root@192.168.110.109's password:

原来的/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted



故障解决方法:
修改
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX= disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

重启服务器
能通过密匙访问了
[root@XX-0 .ssh]# ssh 192.168.x.x
Last login: Thu Apr 19 01:52:15 2012 from 192.168.x.x
------------------------------------------------------
生成密匙
# ssh-keygen -t dsa
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
96:22:e3:a9:ac:a0:45:24:19:c2:c2:1a:75:d9:61:f9 root@XX-test
The key's randomart image is:
--[ DSA 1024]----
|=.. .ooo         |
| = ...o          |
Y
能正常生成密匙,至此故障解决。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值