Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.ssh directory does not exist debian

Tags:

ssh

putty

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

like image 670
dav Avatar asked May 04 '14 13:05

dav


People also ask

Where is my .ssh directory?

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.

How do I view .ssh directory in Linux?

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.

What is .ssh folder in Linux?

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.

How do I open a .ssh folder in Ubuntu?

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 ~/.


1 Answers

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.

like image 132
mofoe Avatar answered Oct 12 '22 13:10

mofoe