SSH - ssh-keygen permission denied

Hello, people!

While trying to generate an SSH key, i got this error:

Saving key "/home/spartan/.ssh/id_rsa" failed: Permission denied

This is a 1-week old install, nothing out of the ordinary.

Tried chmod-ing the folder ( u+xr,go-rwx ) and the error persists. Any ideas where i should look to fix this?

Thanks

Hi

Just tried reproducing the described behavior on my machine. It all worked fine.

Have you check for OS upgrades? Also could you please list the directory with its permissions?
That way I could compare them with mine.

Hi Dimitri,

As requested.

drwx------ 2 root 4096 ago 29 01:19 .ssh

Thank you for your help

that is a little odd in itself - my .ssh permissions is user:user - your’s in root:ago

What about the contents of the .ssh folder - again, all my files are user:user owned.

What I generally do is I set my SSH folder to have the following permissions.

sudo chmod -r 700 ~/.ssh && sudo chmod 600 ~/.ssh/id_rsa*

This assumes that your SSH keys are not named differently from the defaults. your SSH Keys essentially requires 600 for SSH to function properly.