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?
I am assuming that you have enough permissions to create this directory.
To fix your problem, you can either ssh to some other location:
and accept new key - it will create directory
~/.ssh
andknown_hosts
underneath, or simply create it manually usingNote that
chmod 700
is an important step!After that, ssh-keygen should work without complaints.
Yes. You need to create the directory:
Additionally, SSH requires you to set the permissions so that only you (the owner) can access anything in ~/.ssh:
No. This command generates an SSH key pair but will fail if it cannot write to the required directory:
Once you've created your keys, you should also restrict who can read those key files to just yourself:
As a slight improvement over the other answers, you can do the
mkdir
andchmod
as a single operation usingmkdir
's-m
switch.Usage
From a Linux system