SSH не обнаруживает метод аутентификации
В общем, я пытаюсь создать учетную запись SFTP для части моего сервера, которая не нуждается ни в SSH-ключе, ни в модуле googles-2fa-pam. У меня есть следующий параметр в моем файле /etc/ssh/sshd_config:
Match User sharex
PubkeyAuthentication no
PasswordAuthentication yes
AuthenticationMethods password
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
ForceCommand internal-sftp
ChrootDirectory /home/sharex
Это внизу моего файла /etc/pam.d/sshd:
# Standard Un*x password updating.
@include common-password
auth required pam_google_authenticator.so nullok
Ошибка при запуске "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: /system.slice/ssh.service
└─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]
Когда я пытаюсь войти в учетную запись через SSH:
Permission denied, please try again.
Вывод 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: 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: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.
Сможет ли кто-нибудь мне помочь или попытаться намекнуть в правильном направлении, потому что я не знаю, что я могу сделать. Если вам нужна дополнительная информация, такая как файлы конфигурации, просто ответьте ниже:) Спасибо!
1 ответ
Добавьте это после UsePAM yes в /etc/ssh/sshd_config или ssh_config.
AuthenticationMethods publickey,keyboard-interactive