Ssh Doesn't Detect Authenticationmethod

Ssh Doesn't Detect Authenticationmethod

So basically I'm trying to create an SFTP account for a part of my server that doesn't need an SSH-Key nor googles-2fa-pam module. I've got the following setting in my /etc/ssh/sshd_config file:

Match User sharex
    PubkeyAuthentication no
    PasswordAuthentication yes
    AuthenticationMethods password
    PermitTunnel no
    AllowAgentForwarding no
    AllowTcpForwarding no
    X11Forwarding no
    ForceCommand internal-sftp
    ChrootDirectory /home/sharex

This is at the bottom of my /etc/pam.d/sshd file:

# Standard Un*x password updating.
@include common-password
auth required pam_google_authenticator.so nullok

The error when running "service ssh status":

● ssh.service - OpenBSD Secure Shell server
 Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-01-19 11:22:25 CET; 52min ago
  Process: 20132 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 20143 (sshd)
    Tasks: 1 (limit: 4583)
   CGroup: /
       └─20143 /usr/sbin/sshd -D

Jan 19 11:22:25 mango systemd[1]: Starting OpenBSD Secure Shell server...
Jan 19 11:22:25 mango sshd[20132]: Disabled method "password" in 
AuthenticationMethods list "publickey,password"
Jan 19 11:22:25 mango sshd[20143]: Disabled method "password" in AuthenticationMethods list "publickey,password"
Jan 19 11:22:25 mango sshd[20143]: Server listening on 0.0.0.0 port XXX.
Jan 19 11:22:25 mango sshd[20143]: Server listening on :: port XXX.
Jan 19 11:22:25 mango systemd[1]: Started OpenBSD Secure Shell server.
Jan 19 11:22:44 mango sshd[20224]: error: Disabled method "password" in AuthenticationMethods list "publickey,password"
Jan 19 11:22:46 mango sshd[20224]: Failed password for sharex from 127.0.0.1 port 56442 ssh2
Jan 19 11:22:47 mango sshd[20224]: Connection closed by authenticating user sharex 127.0.0.1 port 56442 [preauth]

When I try logging into the account via ssh:

Permission denied, please try again.

Output of ssh -v:

root@mango ~ # ssh -v sharex@localhost -p XXX OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to localhost [127.0.0.1] port XXX. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubunt u-4ubuntu0.1 debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.1 pat OpenSSH* compat 0x04000000 debug1: Authenticating to localhost:XXX as 'sharex' 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: MAC: <implicit > compression: none debug1: kex: client->server cipher: MAC: <implicit > compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Lj/m0+cUQjvYHaXu57qYTtTeg878 c6KgQxk03AhOcUw debug1: Host '[localhost]:XXX' is known and matches the ECDSA host key. debug1: Found key in /root/.ssh/known_hosts:1 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=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rs a-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: password debug1: Next authentication method: password sharex@localhost's password: debug1: Authentications that can continue: password Permission denied, please try again.

Would anyone be able to assist me or try to hint me in the right direction as I don't know what I could do. If you need any more information such as configuration files just reply below :) Thank you!

12

1 Answer

Add this after the UsePAM yes in /etc/ssh/sshd_config or ssh_config

AuthenticationMethods publickey,keyboard-interactive

Your Answer

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

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.