Public ssh key authentication ? How?


#1

Installed this script.

Unable to login via ssh pub_key authentication,

Here is the sshd_config file: https://justpaste.it/16407

Here is the ‘ls -la’ output of .ssh folder from master account.

drwxrwx--- 2 user1 user1 4096 May 1 18:53 ./ drwxrwx--- 10 user1 user1 4096 May 1 18:22 ../ -rw------- 1 user1 user1 398 May 1 18:50 authorized_keys

key is correct in authorized keys. In default OS, ssh keys work whereas after script installation, key authentication doesnt works. If i use default sshd_config file, after script installation, the public authentication doesnt works.


#2

Have you reviewed this Wiki as a guideline:


#3

Done the above.


#4

You have the .ssh directory created at /root/ with permissions set accordingly? Have you done a restart of the ssh service?


#5

done , no joy.


#6

UPDATE:

I am able to login via root account using ssh keys but not as my master account.


#7

Correct, that Wiki is for allowing root access securely with an authorized key. To use it as your master account then you will need to do the same, but in the /home/USERNAME directory.


#8

Re-did as suggested for master account but cant use ssh public keys.

strange.


#9

try this? The times I’ve seen it not work have all been around the security of the files. You can also look at /var/log/auth.log for information on why its not working.

chmod 700 $HOME/.ssh
chmod go-w $HOME $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
chown `whoami` $HOME/.ssh/authorized_keys

#10

That’s it. the following command solved it.
Mind explaining what went wrong ?


#11

It took away write access for the group and other to your home directory.
It’s odd that those were set as its not normal. Did you set them?

public key requires that no one else have write access to your home dir.