-1

I can no longer log in to my server. All I did was try to copy an ID to a different server, but now I get prompted for my password every time I log in.

Attempt 1.

Copy the .ssh directory from a server that works, but I still can't log in.

Attempt 2.

regenerate keys with ssh-keygen and then ssh-copy-id but this still fails

Attempt 3.

SSH keys no longer work? none of the solutions here apply to me

the output of ssh -v user@host:

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /home/con/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to biofx [172.20.192.999] port 22.
debug1: Connection established.
debug1: identity file /home/con/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/con/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to biofx:22 as '703404669'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:8fiKESvA4Ot+tSMYymLJgglVGWmuQLIMSOLXnwjNtFY
debug1: Host 'biofx' is known and matches the ECDSA host key.
debug1: Found key in /home/con/.ssh/known_hosts:18
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)

debug1: Next authentication method: publickey
debug1: Offering public key: RSA ****** /home/con/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/con/.ssh/id_dsa
debug1: Trying private key: /home/con/.ssh/id_ecdsa
debug1: Trying private key: /home/con/.ssh/id_ed25519
debug1: Next authentication method: password
703404669@biofx's password: 
debug1: Authentication succeeded (password).
Authenticated to biofx ([172.20.192.999]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/703404669
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Wed Jun 24 16:06:28 2020 from 172.22.146.48

How can I get my password-less login working again?

con
  • 103
  • 3

1 Answers1

2

The problem is describe in this error message: Remote: Ignored authorized keys: bad ownership or modes for directory /home/703404669

You need to fix the permission on the home folder and .ssh/authorized_keys :

sudo chown 703404669 ~/ ~/.ssh ~/.ssh/authorized_keys
sudo chmod go= ~/.ssh ~/.ssh/authorized_keys
sudo chmod go-w ~/

Having 703404669 is very strange for an username.

Mircea Vutcovici
  • 16,706
  • 4
  • 52
  • 80