Skip to content
Advertisement

ssh key gen Permission Denied [closed]

I am trying to make ssh key for a the deployer user

[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.

i have tried all of theses

[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

Advertisement

Answer

It looks like you don’t have the privileges to save the files necessary to complete the operation. Try running the same command using sudo:

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

When prompted for a password, enter your password. If this doesn’t work, you can try using the command su, which will switch to the root user directly.

Advertisement