ssh key gen权限被拒绝

时间:2015-09-07 00:57:20

标签: linux permissions centos ssh-keys

我正在尝试为部署用户制作ssh密钥

[deployer@server /]$ ssh-keygen -t rsa -b 4096 -C "email@yahoo.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/deployer/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open /home/deployer/.ssh/id_rsa failed: Permission denied.
Saving the key failed: /home/deployer/.ssh/id_rsa.

我已经尝试了所有这些

[root@server /]# chmod -R 644 /home/deployer
[root@server /]# chmod -R 755 home/deployer
[root@server /]# chmod -R 755 /home/deployer
[root@server /]# chmod -R 755 home/deployer

3 个答案:

答案 0 :(得分:1)

您似乎没有权限来保存完成操作所需的文件。尝试使用sudo运行相同的命令:

sudo ssh-keygen -t rsa -b 4096 -C "email@yahoo.com"

提示输入密码时,请输入您的密码。如果这不起作用,您可以尝试使用su命令,该命令将直接切换到root用户。

答案 1 :(得分:0)

看起来deployer不是其主目录的所有者。试着给他所有权: [root@server /]# chown -R deployer: /home/deployer/

答案 2 :(得分:0)

尝试以下方法:

1)cd / home / deployer

2)ssh-keygen --t

3)chmod 700 .ssh