0

I have school project server - debian 8 jessie and I have working SSH Key-based authentication. My problem is, that I created new user named tester and he is unable to connect to server and it give the following error:

No supported authentication methods available public key

I tried to change testers key to my own and then I tried to connect as tester by myself but it doesn't work.

I'm really newbie to this, so i have no clue what is wrong. I will be happy for any advices.

I used these commands

useradd -G users,sudo tester passwd tester mkdir /home/tester mkdir /home/tester/.ssh chown tester:tester /home/tester chown tester:tester /home/tester/.ssh chmod go-rx /home/tester chmod go-rx /home/tester/.ssh mv /home/marm04/authorized_keys /home/tester/.ssh chown tester:tester /home/tester/.ssh/authorized_keys 

enter image description here

7
  • Possible duplicate of Login with SSH public key doesn't work. I assume the server has the private key on it? I went ahead and fix your grammatical mistakes. Please spend more time doing that yourself in the future. Commented Dec 8, 2016 at 1:04
  • Yes server has the private key. Im sorry for my grammatical mistakes. Commented Dec 8, 2016 at 1:15
  • Does it have the public key? Provide us the output to: ls -l //home/tester/.ssh/authorized_keys Commented Dec 8, 2016 at 1:24
  • -rwxrwxrwx 1 tester tester 396 Sep 30 13:46 //home/tester/.ssh/authorized_keys Commented Dec 8, 2016 at 1:27
  • I need the output to whatever command, will list all the keys, you currently have installed on the server. Commented Dec 8, 2016 at 1:29

2 Answers 2

0

I think you are "doing it wrong", and there is more then 1 problem here, so lets work through them.

  1. ~username/.ssh/authorized_keys needs to have a list of keys which can authenticate as that user. So if both you and him are wanting to log in as him, this is possible. You need to put both your public keys in the authorized_keys file - 1 key per line. When you log in using your key, you still log in as username@ip (ie his username, not yours.

  2. I note that you moved "marm04" key to his account. Assuming you are marm04, that is a mistake, you want to copy or cat it, so, assuming you already have his key there, the command to use would be cat ~marm04/.ssh/authorized_keys >> ~tester/.ssh/authorized_keys

  3. You should also check /etc/ssh/sshd_config and make sure that there is no line starting "AllowUsers", or, if there is, you will need to adjust it so he (and maybe his IP depending on how its written) can log in, and then restart SSHD.

  4. You need to be a bit careful with what you are doing with permissions. It looks like you have made the directory executable, and changed its permissions, but you have not changed the permissions on the authorized_keys file.

0

I just solved it. I checked /var/log/auth.log and i found this line

2016-12-08T00:35:40.869224+01:00 info auth sshd[1554]: Authentication refused: bad ownership or modes for file /home/tester 

So i ran this command

chmod 755 /home/tester 

and it works now. It is really stupid mistake. I hope it will help someone else in the future who will be as desperate as am I.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.