Page MenuHomeSolus

Can't get pub key authentication to work (ssh)
Closed, ResolvedPublic

Description

Steps:

  1. generate public key ssh-keygen -t rsa -b 4096
  2. place it in ~/.ssh/authorized_keys
  3. set 'PasswordAuthentication' to no in /etc/sshd_config
  4. restart service
  5. ssh localhost -vvv

Note: trying to ssh from my phone (with the .pub key in the authorized_keys folder) did not work either.
Note: both work if I enable password authentication.

Google, namely, ubuntu's documentation, told me this could stem from improper (or overly lax) file permissions but:

λ space ~ → sudo ls -l ~/.ssh/               
total 12
drw------- 2 desktop desktop 4096 Feb 17 00:36 authorized_keys
-rw------- 1 desktop desktop 3243 Feb 17 00:36 id_rsa
-rw-r--r-- 1 desktop desktop  171 Feb 16 23:40 known_hosts

All fine and dandy. Then I tried to disable StrictMode in sshd_config, but it did not work either.

sshd_config:

Any clues?

Event Timeline

BRM created this task.Feb 17 2017, 12:52 AM

drw------- 2 desktop desktop 4096 Feb 17 00:36 authorized_keys

This should be a file, not a directory. It should also be mode 00600

Each authorized key then needs to be on it's own line within ~/.ssh/authorized_keys :)

BRM closed this task as Resolved.Feb 17 2017, 3:16 PM
BRM claimed this task.

Thanks ikey, useful as always.