I installed openssh, but I can’t find the .ssh
directory. Could anyone be able to tell me where could I find this directory?
P.S. I installed Ubuntu 16.10 as a virtual machine.
asked Dec 9, 2016 at 15:59
Sandra RossSandra Ross
7773 gold badges10 silver badges20 bronze badges
3
The file is not created by the installation, but upon the first use of ssh
or ssh-keygen
. If it is not there, there is nothing to worry about. You can simply create it using mkdir ~/.ssh/
.
answered Dec 9, 2016 at 16:42
JakujeJakuje
6,4657 gold badges29 silver badges37 bronze badges
2
Check here for the .ssh directory in here /home/your-username/.ssh
.
Its hidden as a result of the dot(.) before the name.
So to find it do ls -a | grep .ssh
in your current location as seen in the image. Also try using nautilus
answered Dec 9, 2016 at 16:10
George UdosenGeorge Udosen
35.6k12 gold badges98 silver badges120 bronze badges
4
You can go to Home and press Ctrl H, you can see a folder called .ssh
answered Aug 22, 2022 at 15:57
0
Older topic but if anyone else is looking for an answer and got here from a google search..
If you have connected FROM a “username” to a remote machine and accepted the key then you should look for .ssh folder in /home/username …
If you don’t find the .ssh folder then you have probably connected from a different user .. for example ‘root’ , then the .ssh folder is in the root directory /
Hope it helps others 🙂
answered Jul 1, 2022 at 6:54
In macOS, you need to generate your public and private keys from the Terminal. If you haven’t yet done this, the .ssh
directory will not exist. To create them:
Open the terminal App and enter the following command:
ssh-keygen
You’ll get a prompt to choose the location for the keys. It
will say “Enter file in which to save the key
(/Users/your-username/.ssh/id_rsa)”. If you’re happy with the default location(~/.ssh/) just tap Return. Within your shell the ~
character is equivalent to /Users/your-username/
. It stands for your home directory.
It will now say “Enter passphrase (empty
for no passphrase):”. Enter your passphrase and press Return. You are
asked to re-enter the password to confirm you typed it correctly. This passphrase is used to encrypt the private key and it’s recommended you set one.
The prompt will now say “Your identification has been saved in
/Users/your-username/.ssh/id_rsa” and “Your public key has been saved in
/Users/your-username/.ssh/id_rsa.pub.” It’ll then show you the key’s Fingerprint and Randomart. The Fingerprint matches the public
key and can be used in some situations for authentication, and the
Randomart file is designed to match the Fingerprint but be easier to
visually identify that it is the right key. You don’t need to copy these down for most purposes.
Now you can view the newly-created .ssh directory and find your key within.
You can find a pretty readable guide on the subject here.
Edit: If you want to copy in previously-saved public and private keys:
- In the terminal, enter
cd ~
- Then
mkdir .ssh; chmod 700 ~/.ssh
This will create the directory and give it adequate permissions. Within this directory, you can now paste in your two files which contain the matching public and private key pair. These will be your id_rsa.pub and id_rsa files respectively. Once this is done, double-check their permissions are what they need to be by running:
ls -l ~/.ssh/id_rsa*
The output should look like this(except the numbers 1766 and 388):
-rw------- 1 user root 1766 Oct 04 2017 .ssh/id_rsa
-rw-r--r-- 1 user root 388 Oct 04 2017 .ssh/id_rsa.pub
In case you get something that doesn’t look like this, set the permissions of these files with:
$ chown user:user ~/.ssh/id_rsa*
$ chmod 600 ~/.ssh/id_rsa
$ chmod 644 ~/.ssh/id_rsa.pub
Note that with chown user:user ~/.ssh/id_rsa* just above, user is the user account you’re logged in with, not literally “user”.
I have tried the following steps from How to access my .ssh folder for Transmit or Cyberduck?:
In the find file window, press Command-Shift-G. It’ll ask you what folder to navigate to. Enter “~/.ssh” and press return.
… but I did not get any reply. The screen remains the same. What am I doing wrong?
nohillside♦
94.2k40 gold badges201 silver badges247 bronze badges
asked Dec 22, 2018 at 13:59
1
You might need to create the folder first. For this, open Terminal and run
mkdir ~/.ssh; chmod 700 ~/.ssh
Also, when entering ~/.ssh
in the dialog shown after pressing Shift-Cmd-G it’s important to enter the string without the ""
:
answered Dec 22, 2018 at 15:07
nohillside♦nohillside
94.2k40 gold badges201 silver badges247 bronze badges
1
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
On windows it is usually stored in the %USERPROFILE%ssh or
%USERPROFILE%.ssh folders.
However I do not see the ssh folders when going to %USERPROFILE%.
Is it possible to create the ssh folder and the known_hosts file myself?
asked Apr 14, 2021 at 11:36
Yes, this is expected.
You can in a CMD do:
cd "%USERPROFILE%"
mkdir .ssh
From there, assuming you have ssh-keygen in your PATH (which is included in Git For Windows for example), you can type:
ssh-keygen -t rsa -P ""
That will generate a key in the default path ~/.ssh(/id_rsa[.pub])
, with ~/.ssh
being translated in %USERPROFILE%.ssh
answered Apr 15, 2021 at 6:43
VonCVonC
1.2m514 gold badges4332 silver badges5150 bronze badges
0
Prerequisites
- Windows Subsystem for Linux (WSL) is installed
- For this example we will use the Ubuntu Linux distro/distribution.
- Visit this link to rocket academy to find out more about WSL
Step 1: Understand how to access Linux On Windows
Method 1: Using the file explorer
-
Type
\wsl$
into the file explorer. This will direct you to the location of the Ubuntu folder.
-
Navigate to your linux folder.
Ubuntu -> Home -> <LINUX USERNAME>
Method 2: Using the WSL terminal
# This command navigates to the linux folder
cd ~/
Enter fullscreen mode
Exit fullscreen mode
# This command lists the files that are in the linux folder
ls -a ~
Enter fullscreen mode
Exit fullscreen mode
Step 2: Create .ssh folder (this is where we’ll put the ssh key)
Notes: If this is your first time accessing this folder, you probably do not have a folder for ssh files and will have to create your own.
Method 1: Using the file explorer
- Create a folder in your linux folder and name it “.ssh”
- Done! Now you can put the key pairs in this folder
Method 2: Using the WSL terminal
# 1. Check if you have a .ssh folder. If you don't have an ssh folder it'll return "No such file or directory"
ls ~/.ssh
Enter fullscreen mode
Exit fullscreen mode
# 2. Create a folder called .ssh
mkdir ~/.ssh
Enter fullscreen mode
Exit fullscreen mode
# 3. Copy any key pairs you need into this folder
# Note: You have to be in the same directory as the file you want to copy
# syntax: cp <FILENAME> ~/.ssh
cp my-aws-ec2-keypair.pem ~/.ssh
Enter fullscreen mode
Exit fullscreen mode