Posts Linux .ssh folder permisisons for public private key authentication
Post
Cancel

Linux .ssh folder permisisons for public private key authentication

  • Login as user for which you are setting .ssh
1
2
3
4
5
6
7
$ ls -lrta

drwx------   2 user user    29 Aug 01 06:20 .ssh

$ #make sure the permisions are same as above else execute the below command to make them so

$ chmod 700 .ssh
  • Enable public private key pair authentication
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ cd .ssh

$ ls -lrt

rw------- 1 user user 560 Aug 01 06:20 authorized_keys

$ #make sure the permisions are same as above else execute the below command to make them so

$ chmod -R 600 authorized_keys

$ # if the authorized_keys file does not exist then make

$ touch authorized_keys

$ # set permissions

$ chmod -R 600 authorized_keys
  • Now add your public key to the authorized_keys file

  • Then use the private key linked to the public key that you added to the authorized_keys file to ssh into the box

This post is licensed under CC BY 4.0 by the author.