linux - ssh via public keys failing for account on CentOS 6 with user id below 500 -


i converted non-login user jenkins, created jenkins ci server installation, allow log in doing following:

  1. adding home dir , shell in /etc/passwd file jenkins user
  2. creating home directory

i created public private key pair by

  1. added public & private keys in .ssh directory in new home space
  2. created , authorized_keys file
  3. set correct permissions .ssh directory , contents.

now, on machine, root can su - jenkins , become jenkins user. however, on remote machine cannot ssh public key machine (as jenkins user respective keys).

i created new user on machine via useradd, copied jenkins ssh keys on account , able log in user using keys.

i'm stumped special jenkins user blocking ssh public key access. thing sticks out in mind jenkins user created user id of 498. there blocking 'system' user allowing ssh?

the end of ssh command -v enabled failing login user jenkins looks this:

 debug1: authentications can continue: publickey,gssapi-keyex,gssapi-with-mic  debug1: next authentication method: publickey  debug1: trying private key: id_rsa  debug1: read pem private key done: type rsa  debug1: authentications can continue: publickey,gssapi-keyex,gssapi-with-mic  debug1: no more authentication methods try.  permission denied (publickey,gssapi-keyex,gssapi-with-mic). 

the successfull login user foo (with same keys):

 debug1: authentications can continue: publickey,gssapi-keyex,gssapi-with-mic  debug1: next authentication method: publickey  debug1: trying private key: id_rsa  debug1: read pem private key done: type rsa  debug1: authentication succeeded (publickey).  authenticated jenkins.internal.nara.me ([54.83.203.146]:22).  debug1: channel 0: new [client-session]  debug1: requesting no-more-sessions@openssh.com  debug1: entering interactive session.  debug1: sending environment.  debug1: sending env lang = en_us.utf-8 

you missing among :

  • permission on home directory of jenkins user not right (like not owned user, or world or group-writableà
  • ssh not allowing key-based authentication users
  • having unexpected carrigae-return in authorized_keys file

to debug this, reload sshd

loglevel verbose 

in /etc/ssh/sshd_config

and @ /var/log/auth.log (or centos equivalent) information on why key not accepted. in verbose mode, sshd says why ;)


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -