0

I have recently taken over the management of a couple servers. Both servers need to allow ssh connection from jenkins user, which is managed by LDAP. Both servers show the user information when I type in id jenkins.

I've created a home directory for the user in both servers. Both servers contain the same public key in the user's authorized_keys file. All permission settings are identical.

When attempting to ssh into server A as jenkins user, this is what the log shows.

debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /jenkins/.ssh/id_rsa
debug3: sign_and_send_pubkey: RSA KEY
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug1: Trying private key: /jenkins/.ssh/id_dsa
debug3: no such identity: /jenkins/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /jenkins/.ssh/id_ecdsa
debug3: no such identity: /jenkins/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /jenkins/.ssh/id_ed25519
debug3: no such identity: /jenkins/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

When sshing into Server B as jenkins user from the same server, this is what the log shows.

debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /jenkins/.ssh/id_rsa
debug3: sign_and_send_pubkey: RSA KEY
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
Authenticated to SERVER A ([IP ADDRESS]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env SHELL
debug3: Ignored env TERM
debug3: Ignored env USER
debug3: Ignored env SUDO_USER
debug3: Ignored env SUDO_UID
debug3: Ignored env USERNAME
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env PWD
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SHLVL
debug3: Ignored env SUDO_COMMAND
debug3: Ignored env HOME
debug3: Ignored env LOGNAME
debug3: Ignored env SUDO_GID
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0

Basically, jenkins user can ssh into Server A, but not Server B when both servers contain the same home directory for the user. I've had to modify the /etc/passwd and /etc/shadow file on Server A to get it to work.

What is going on here?

  • 1
    Can you provide the output of getent passwd jenkins on both machines? – David Jan 18 '18 at 6:09
  • 1
    Can you verify that the integration with LDAP works properly and that the LDAP jenkins user can be displayed from Server A? – Itai Ganot Jan 18 '18 at 7:28
  • Thank you guys. Running getent passwd jenkins showed me that the home directory for the user is actually set differently in both servers. – jeebface Jan 18 '18 at 18:45
0

I ran getent passwd jenkins as David suggested and it showed that the home directory path for the user is set differently in both machines. This solves my question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.