Chinaunix

标题: 使用密钥登录时遇到错误 [打印本页]

作者: zfdream101    时间: 2012-03-14 14:48
标题: 使用密钥登录时遇到错误
ssh-keygen -i -f lgz-keys.pub >> authorized_keys我执行这一句的时候
会提示我lgz-keys.pub: Permission denied
这是怎么一回事
作者: chenyx    时间: 2012-03-14 14:51
Permission denied

权限问题,检查下文件的权限
作者: zfdream101    时间: 2012-03-14 14:58
-rwx------. 1 root root   17 Mar 14 14:37 authorization
-rw-r-----. 1 root root    0 Mar 14 15:38 authorized_keys
-rwxr-xr-x. 1 root root 1236 Mar 14 13:19 lgz-keys.pub

作者: zfdream101    时间: 2012-03-14 14:59
-rwx------. 1 root root   17 Mar 14 14:37 authorization
-rw-r-----. 1 root root    0 Mar 14 15:38 authorized_keys
-rwxr-xr-x. 1 root root 1236 Mar 14 13:19 lgz-keys.pub
应该没有问题吧?这样,我用root用户登录的。
回复 2# chenyx


   
作者: chenyx    时间: 2012-03-14 14:59
root用户?文件权限没有问题啊,你看下系统日志还有别的提示没有
作者: zfdream101    时间: 2012-03-14 15:00
怎么看系统日志?看什么?回复 5# chenyx


   
作者: chenyx    时间: 2012-03-14 15:02
tail /var/log/messages
作者: zfdream101    时间: 2012-03-14 15:06
运行tail /var/log/messages
后出现:
Mar 14 12:44:24 localhost kernel: lo: Disabled Privacy Extensions
Mar 14 12:44:24 localhost kernel: ip6_tables: (C) 2000-2006 Netfilter Core Team
Mar 14 12:44:24 localhost kernel: nf_conntrack version 0.5.0 (16106 buckets, 64424 max)
Mar 14 12:44:24 localhost kernel: ip_tables: (C) 2000-2006 Netfilter Core Team
Mar 14 12:44:24 localhost kernel: eth0: intr type 3, mode 0, 3 vectors allocated
Mar 14 12:44:24 localhost kernel: eth0: NIC Link is Up 10000 Mbps
Mar 14 12:44:27 localhost qpidd[1214]: 2012-03-14 12:44:27 notice Listening on TCP port 5672
Mar 14 12:44:27 localhost qpidd[1214]: 2012-03-14 12:44:27 notice SSL plugin not enabled, you must set --ssl-cert-db to enable it.
Mar 14 12:44:27 localhost qpidd[1214]: 2012-03-14 12:44:27 notice Broker running
Mar 14 14:14:05 localhost kernel: ip_tables: (C) 2000-2006 Netfilter Core Team
回复 7# chenyx


   
作者: zfdream101    时间: 2012-03-14 18:19
有大侠帮忙没?
作者: zfdream101    时间: 2012-03-14 23:47
编辑/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 - SELinux is fully disabled.
SELINUX=enforcing

把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。

当我改成这样后,就可以执行了。
作者: chenyx    时间: 2012-03-15 08:32
Selinux的问题?楼主的Centos是什么版本的?
selinux造成的问题,messages应该有记录的
作者: zfdream101    时间: 2012-03-15 10:49
CentOS6.2最简安装的回复 11# chenyx


   




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2