Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify ~/.ssh folder & files in windows?

I feel like I am missing some fundamental concept as to how the .ssh directory works in windows. I have had no issues when working in OSX/Linux like I am having now. My end goal is simply to move my existing ssh key into the default ~/.ssh directory, and update the config if I so choose (you know, normal ssh key related tasks).

However, any time I have tried to move my existing SSH key over to the ~/.ssh directory, or open it, or even create a config file I just get the following error (in either gitbash, puttygen, etc...):

Puttygen (saving the key to disk):

Overwrite existing file C:\Users\me\.ssh?

or in gitbash (attempting to do anything, including just create the config file):

touch: creating `/c/Users/me/.ssh/config': No such file or directory

cd ~/.ssh

sh.exe": cd: /c/Users/me/.ssh: Not a directory

What am I missing/not understanding?

Kind Regards, u353

like image 835
u353 Avatar asked Apr 14 '14 15:04

u353


1 Answers

This answer for Windows environment:

At the beginning, Windows didn't have .ssh folder.

When your run command for creating a ssh key like this:

ssh-keygen -t rsa -b 4096 -C "[email protected]" (must run your terminal as administrator).

Your is_rsa and id_rsa.pub files will be placed under C:\Users\your_username\

So, you need to create folder C:\Users\your_username\.ssh yourself then copy the ssh files to there. You also have to create file C:\Users\your_username.ssh\config and edit it for the first time.

Next ssh will be placed under the .ssh folder automatically.

Note: ~/ is the same as C:\Users\your_username\ on Windows

like image 125
dqthe Avatar answered Sep 23 '22 05:09

dqthe