I am trying to set up public-private key authentication by this article http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html
Im on the step of adding public key into authorized_keys
file, which should be located in .ssh
directory. But that .ssh directory does not exist. ls -a
outputs this
. boot etc lib mnt root srv usr
.. dead.letter home lost+found opt sbin sys var
bin dev initrd.img media proc selinux tmp vmlinuz
this does not show any results
find / -name 'authorized_keys'
So, should I create it, or I should install something and it will appear.
Thanks
ssh directory. File paths for user's home directories can be found in /etc/passwd. The default directory and name for new keys is ~/. ssh/id_rsa, and this is where SSH will look for your keys.
If you able to cd ~ssh from one user then use ls -a command in the that user's home directory. If you really want to see the files in the file browser then create a directory without starting with a dot and copy all the contents from the . ssh directory to the new directory which you have created.
For SSH to work well, it requires correct permissions on the ~/. ssh or /home/username/. ssh directory: the default location for all user-specific ssh configuration and authentication files. The recommended permissions are read/write/execute for the user, and must not be accessible by group and others.
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 ~/.
Yes, you should create the .ssh directory and authorized_keys file if they don't exist.
Create it in the home folder of the user you want to log in as.
Try some thing like this:
cd
mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
Then add your key to the authorized_keys
file.
Alternatively, you can use the command ssh-copy-id
from the source machine to automate the process for you:
ssh-copy-id user@host
This will create the ~/.ssh
directory and copy your public key into the file ~/.ssh/authorized_keys
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With