26

enter image description here

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.

Sandra Ross
  • 777
  • 3
  • 10
  • 20
  • 1
    The .ssh directory is not by default created below your home directory. When you call `ssh somehost` (replace 'somehost' by the name or IP of a host running sshd), the directory and the file `.ssh/known_hosts` will be created. Instead, you may create it with `mkdir ~/.ssh`. – ridgy Dec 09 '16 at 16:14
  • Try restarting the system, and if doesn't work remove __with sudo apt remove__ then __re-install__ – George Udosen Dec 09 '16 at 16:19
  • 1
    As you have openssh-server installed (and should be running) as well, you just may issue `ssh localhost` and reply `yes` when asked to continue connection. – ridgy Dec 09 '16 at 16:24

4 Answers4

28

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/.

Jakuje
  • 6,505
  • 7
  • 30
  • 37
  • 1
    Is there an environment variable for changing the location of the .ssh directory? – pfincent Apr 15 '22 at 16:22
  • @pfincent not for SSH. It reads the user information from the operating system using getpwnam or getpwuid around these lines: https://github.com/openssh/openssh-portable/blob/master/misc.c#L1171 – Jakuje Apr 17 '22 at 17:54
8

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

George Udosen
  • 35,970
  • 13
  • 99
  • 121
1

You can go to Home and press Ctrl H, you can see a folder called .ssh

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 :)