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

来源:互联网 发布:mysql in 子查询 编辑:程序博客网 时间:2024/05/18 02:41
故障现象:
执行生成密匙命令时提示:
#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
能正常生成密匙,至此故障解决。