The Computer Oracle

How can I change the directory that ssh-keygen outputs to?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Flying Over Ancient Lands

--

Chapters
00:00 How Can I Change The Directory That Ssh-Keygen Outputs To?
00:49 Accepted Answer Score 185
01:25 Answer 2 Score 0
01:41 Answer 3 Score 0
01:56 Thank you

--

Full question
https://superuser.com/questions/1004254/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#ssh #git

#avk47



ACCEPTED ANSWER

Score 185


You should be able to do this by specifying the name of the output file with the -f option, e.g.,

ssh-keygen -t rsa -b 4096 -C "your_email@example.com" -f $HOME/.ssh/id_rsa

Of course, it really helps if the output directory has already been created.

For further reading:




ANSWER 2

Score 0


On Windows 10:

From the accepted answer, $HOME did not work for me for the path, but %userprofile% does:

ssh-keygen -f %userprofile%/.ssh/id_rsa



ANSWER 3

Score 0


For me you should use this option -f like this :

ssh-keygen -t rsa -b 2048 -f /home/user/project/ssh-keys/id_ras

And finally sh-keygen generate two file private and public into this directory

/home/user/project/ssh-keys/id_ras
/home/user/project/ssh-keys/id_ras.pub