Score:0

No such file or directory when trying to create .ssh keys

cn flag

When I attempt to create ssh keys on my Debian instance :

ssh-keygen -f /home/serverkeys/.ssh/id_rsa 

I am getting the error : Saving key "/home/serverkeys/.ssh/id_rsa" failed: No such file or directory

I am using root user and when I check permissions on the directory :

 ls -ld

I get

drwxr-xr-x 2 root root 4096 Oct 17 08:32 .

I have a number of questions :

1)What am I missing and why is the system not able to automatically create the .ssh directory specified ?

2)Do I need to create another user and switch from using root. I am not sure if the new user will inherit permissions on all packages I have so far since I have installed them with root user profile?

I intend to use the ssh keys for integration between Jenkins and Gitlab as outlined here Jenkins_GitlabIntegration

In the example however the Jenkins instance and Gitlab instance are installed on different servers and yet for my setup they are installed on the same Debian instance and also my Gitlab repo is public.

I am unsure as to whether I still need the ssh key because Jenkins and Gitlab are running on same Debian instance eg would Jenkins still need ssh keys in order to checkout the code from Gitlab.

francois P avatar
in flag
check permissions on .ssh directory & even on /home/serverkeys just in case.
Score:1
za flag

The -f key_file switch by itself does not create new keys and will also not create a .ssh directory. The -f switch is also used to take an existing key_file as input, when used with other switches. See man ssh-keygen

You need to use the -c option and ssh-keygen-c-f /home/serverkeys/.ssh/id_rsa to create a new private key.

cn flag
ssh-keygen -c -f /home/serverkeys/.ssh/id_rsa /home/serverkeys/.ssh/id_rsa: No such file or directory
cn flag
same error still showing
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.