bash: /home/myuser/.ssh/authorized_keys: No such file or directory

21 January,2020 by Jack Vamvas

Question: When I type in cat ~/.ssh/authorized_keys   to a RHEL 7 server I get the following message:

cat: /root/.ssh/authorized_keys: No such file or directory

I'm going through the process of setting up a SSH  to create a connection between BART and client Potgresql servers - to backup Postgresql  databases. How can I fix this issue?

Answer:You need to create the ssh directory for the first time and create the authorized keys file. 

  1. Create the .ssh directory. First check if actually already exists

    mkdir ~/.ssh
    
  2. Set the right permissions for the new .ssh directory. Very important step 

    chmod 700 ~/.ssh
    
  3. Create the authorized_keys file (where the keys will be added)

    touch ~/.ssh/authorized_keys
    
  4. Set the right permissions:

    chmod 600 ~/.ssh/authorized_keys
    

The access to the authorized keys won't work - if the right permissions are not set.

Once you've completed these steps you can add the public keys

 


Author: Jack Vamvas (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on bash: /home/myuser/.ssh/authorized_keys: No such file or directory


dba-ninja.com