First run passwd command to change the password, after inputting new password, following output is shown.
passwd: password updated successfully
I bind docker port 22 to host port 33333, then running following command to connect to it using ssh with the new password we set earlier
1 |
ssh -p 33333 root@localhost |
After inputing password, following error is appeared
Permission denied, please try again.
SSH logs from /var/log/auth.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
May 16 08:52:19 789c53cf55d3 sshd[132]: Set /proc/self/oom_score_adj from 0 to -1000 May 16 08:52:19 789c53cf55d3 sshd[132]: debug1: Bind to port 22 on 0.0.0.0. May 16 08:52:19 789c53cf55d3 sshd[132]: Server listening on 0.0.0.0 port 22. May 16 08:52:19 789c53cf55d3 sshd[132]: debug1: Bind to port 22 on ::. May 16 08:52:19 789c53cf55d3 sshd[132]: Server listening on :: port 22. May 16 08:52:26 789c53cf55d3 sshd[132]: debug1: Forked child 133. May 16 08:52:26 789c53cf55d3 sshd[133]: Set /proc/self/oom_score_adj to 0 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: inetd sockets after dupping: 3, 3 May 16 08:52:26 789c53cf55d3 sshd[133]: Connection from 172.17.42.1 port 34162 on 172.17.0.25 port 22 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: Client protocol version 2.0; client software version OpenSSH_5.3 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: Enabling compatibility mode for protocol 2.0 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.10 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_KEXINIT sent May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_KEXINIT received May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: kex: client->server aes128-ctr hmac-sha1 none May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: kex: server->client aes128-ctr hmac-sha1 none May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_NEWKEYS sent May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: expecting SSH2_MSG_NEWKEYS May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: SSH2_MSG_NEWKEYS received May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: KEX done May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: userauth-request for user root service ssh-connection method none May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: attempt 0 failures 0 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: PAM: initializing for "root" May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: PAM: setting PAM_RHOST to "172.17.42.1" May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: PAM: setting PAM_TTY to "ssh" May 16 08:52:26 789c53cf55d3 sshd[133]: Failed none for root from 172.17.42.1 port 34162 ssh2 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: userauth-request for user root service ssh-connection method publickey May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: attempt 1 failures 0 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: test whether pkalg/pkblob are acceptable May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: temporarily_use_uid: 0/0 (e=0/0) May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: trying public key file /root/.ssh/authorized_keys May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: Could not open authorized keys '/root/.ssh/authorized_keys': No such file or directory May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: restore_uid: 0/0 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: temporarily_use_uid: 0/0 (e=0/0) May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: trying public key file /root/.ssh/authorized_keys2 May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: Could not open authorized keys '/root/.ssh/authorized_keys2': No such file or directory May 16 08:52:26 789c53cf55d3 sshd[133]: debug1: restore_uid: 0/0 May 16 08:52:26 789c53cf55d3 sshd[133]: Failed publickey for root from 172.17.42.1 port 34162 ssh2 May 16 08:52:28 789c53cf55d3 sshd[133]: debug1: userauth-request for user root service ssh-connection method password May 16 08:52:28 789c53cf55d3 sshd[133]: debug1: attempt 2 failures 1 May 16 08:52:28 789c53cf55d3 sshd[133]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=172.17.42.1 user=root May 16 08:52:29 789c53cf55d3 sshd[133]: debug1: PAM: password authentication failed for root: Authentication failure May 16 08:52:29 789c53cf55d3 sshd[133]: Failed password for root from 172.17.42.1 port 34162 ssh2 |
Solution
To fix this issue, change /etc/ssh/sshd_config
1 |
PermitRootLogin without-password |
to
1 |
PermitRootLogin yes |
Restart sshd and connect to it again, it should work now.