2

Здравствуйте.

Использую VirtualBox на котором стоит Ubuntu Server 16.04

Странное поведение при авторизации по ключу... Если сделать reboot машины, то авторизация по ключу больше не работает...

Выдает ошибку:

disconnected no supported authentication methods available (server sent publickey)

Но, если авторизоваться в окне VirtualBox, и снова попробовать авторизоваться в PuTTY по ключу, то все работает...

А вот все параметры которые я менял в конфиге SSH:

AuthorizedKeysFile        .ssh/authorized_keys
PasswordAuthentication    no

В чем может быть проблема или это нормальное поведение?

А на реальном сервере, оно тоже так будет работать, что нельзя будет сделать reboot?

Ключи делал через PuTTY.

Содержимое authorized_keys:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAutiPFCcNiDbBBuAbH0VwzYQPtIVWF5a1TJdx8j6KQ5uy1FtgDIjbCrwEZxPtEPJKx75SILfY1ouSvpQhGlL1klNt1TFQP3yROpe3T0jFhqaIwk8pkv1Sqj5+73wCT4B/0YJ07qDTQ9A5/32PGe79x88Z/o8Oc9n5BHC5lAeSwMQ6HYXaPQpBAietQyHWcx0R6ktghKwq/TRUHdE0a3zDTR2j9VyTDlQZjfBwPbAGpul2se772tkcW7wP52g4DMjgkzB3wtg5m1iL0Sy2B0OCFgYjBwZM7qH6ggO4xQp3a7dbf7pnMzmP2fnHGMe6rkNQh8PJMTrfRGAnT/BWRU62cw== rsa-key-20180302

Попробовал сгенерировать ключи на сервере, тоже самое...

ssh-keygen -t rsa

Содержимое конфига SSH:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
10
  • Чем ключи генерили? Покажите, что находится в файле authorized_keys.
    – de_frag
    3 мар 2018 в 21:39
  • А ключи вы как генерили, часом не путти?
    – PinkTux
    3 мар 2018 в 21:39
  • Да, все верно, ключи делал через PuTTY
    – Ruslan
    3 мар 2018 в 21:41
  • В вопрос добавил содержимое authorized_keys.
    – Ruslan
    3 мар 2018 в 21:44
  • Ok. Приватный ключ к путти подключили?
    – de_frag
    3 мар 2018 в 21:46

1 ответ 1

0

а где лежит authorized_keys ? обычно путь указывается относительно домашнего каталога пользователя по имени которого осуществляется подключение:

AuthorizedKeysFile  %h/.ssh/authorized_keys

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.