1
When I try to create an SSH key using sudo ssh-keygen -t rsa
I get the request:
Enter file in which to save the key (/root/.ssh/id_rsa):
However, I would like the file to be saved in /home/user2/.ssh/id_rsa
. When I enter that directory I get this error:
Saving key "/home/user2/.ssh/id_rsa" failed: No such file or directory
Any attempt to enter a different directory returns an error.
How can I generate the key in /home/user2/.ssh/id_rsa
?
EDIT: when I remove sudo
I get this problem:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hduser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key "/home/hduser/.ssh/id_rsa" failed: Not a directory
But shouldn't SSH create the directory?
Does the directory
/home/user2/.ssh/
exist? – Kamil Maciorowski – 2018-06-27T07:26:08.2971Why do you call it with
sudo
in the first place? – gronostaj – 2018-06-27T07:26:48.683@KamilMaciorowski I thought that .ssh would get created automatically? – steve zissou – 2018-06-27T07:30:51.803
@gronostaj I'm not sure, i got it from a guide, I'll edit my question to give the output whenever I don't use
sudo
– steve zissou – 2018-06-27T07:31:36.160