.ssh directory not being created

blue-sky picture blue-sky · Mar 3, 2013 · Viewed 153.6k times · Source

To generate the .ssh dir I use this command:

ssh-keygen

taken from this tutorial: http://ebiquity.umbc.edu/Tutorials/Hadoop/05%20-%20Setup%20SSHD.html

But the .ssh directory is not created so when I use cd ~/.ssh I get this error:

"no such file or directory"

Is there a step missing ? Should the .ssh dir be created when I use the ssh-keygen command?

Answer

mvp picture mvp · Mar 3, 2013

I am assuming that you have enough permissions to create this directory.

To fix your problem, you can either ssh to some other location:

ssh [email protected]

and accept new key - it will create directory ~/.ssh and known_hosts underneath, or simply create it manually using

mkdir ~/.ssh
chmod 700 ~/.ssh

Note that chmod 700 is an important step!

After that, ssh-keygen should work without complaints.