创建SSH时获得权限被拒绝

时间:2012-12-31 17:52:22

标签: ssh

[sneha@localhost ~]$  ssh-keygen -t rsa -C "sneha.22.7@gmail.com"

Generating public/private rsa key pair.
Enter file in which to save the key (/home/sneha/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/sneha/.ssh/id_rsa.
Your public key has been saved in /home/sneha/.ssh/id_rsa.pub.
The key fingerprint is:
c8:50:db:0d:eb:cc:23:b3:8a:90:6c:32:80:e8:e2:cc sneha.22.7@gmail.com
The key's randomart image is:

+--[ RSA 2048]----+
|      . .        |
|     . o +       |
|    . . o .      |
|o    o =         |
|+     = S        |
|+.     + .       |
|*+    .          |
|Bo . .           |
| E. .            |
+-----------------+

[sneha@localhost ~]$ /home/sneha/.ssh/id_rsa.pub
bash: /home/sneha/.ssh/id_rsa.pub: Permission denied

任何人都可以帮忙吗?我很确定我正在做所需的一切

2 个答案:

答案 0 :(得分:1)

id_rsa.pub不是可执行文件,它是公钥。尝试运行常规文件将为您提供权限被拒绝错误。你想做什么?通常,您会将该文件附加到要连接的服务器上的~/.ssh/authorized_keys

答案 1 :(得分:0)

原因可能是SELINUX设置为启用。这个SELINUX是linux提供的额外安全层。在这种情况下,我们将无法创建私钥和公钥。我们已向用户提供许可。但不是在应用程序级别。

要执行此操作,请转至/ etc / selinux / config并设置SELINUX = disable