.ssh directory not being created

后端 未结 3 957
南笙
南笙 2021-01-30 08:41

To generate the .ssh dir I use this command:

ssh-keygen

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

3条回答
  •  渐次进展
    2021-01-30 09:13

    Is there a step missing?

    Yes. You need to create the directory:

    mkdir ${HOME}/.ssh
    

    Additionally, SSH requires you to set the permissions so that only you (the owner) can access anything in ~/.ssh:

    % chmod 700 ~/.ssh
    

    Should the .ssh dir be generated when I use the ssh-keygen command?

    No. This command generates an SSH key pair but will fail if it cannot write to the required directory:

    % ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/xxx/.ssh/id_rsa): /Users/tmp/does_not_exist
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    open /Users/tmp/does_not_exist failed: No such file or directory.
    Saving the key failed: /Users/tmp/does_not_exist.
    

    Once you've created your keys, you should also restrict who can read those key files to just yourself:

    % chmod -R go-wrx ~/.ssh/*
    

提交回复
热议问题