14

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

1 Answer 1

28

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.