Як виправити помилку відхиленого дозволу (відкритий ключ)?


11

Під час спроби спілкуватися між моїм робочим столом Ubuntu 12.10 та настільним комп'ютером Fedora 19, я стикаюся з помилкою заборони доступу (відкритий ключ) .
Я в змозі увійти через ssh з Fedora на Ubuntu, але не навпаки.
Я навіть виконував telnet на обох машинах через порт 22, і обидві машини слухають, але не через ssh. Що робити? Будь-яка ідея?

Мій sshd_configфайл такий:

# 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
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

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

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile    %h/.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 yes

# 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

Це sshd_config системи ubuntu.

ssh -v fedora_machine



З якого комп’ютера це sshd_configUbuntu чи Fedora? Також, чи можете ви додати стенограму того, що відбувається, коли ви ssh -v fedora_machineз машини Ubuntu?
Девід Пердю

sshd_config - від ubuntu, щойно я вказав @DavidPurdue ssh -v fedora_mch у питанні.
Vivek Singh

Відповіді:


14

Як ви вже зазначали, поле Fedora, в яке ви входите, не було встановлено, щоб дозволити автентифікацію пароля, а лише автентифікацію відкритих ключів - це видно з ssh -vрезультату.

Отже, одне рішення - додати автентифікацію пароля, як ви це зробили.

Іншим методом було б взяти вміст у ~/.ssh/id_rsa.pubвікні Ubuntu та додати його до файлу ~/.ssh/authorized_keysу вікні Fedora.

Тепер, коли увімкнено автентифікацію пароля, ви можете встановити авторизований ключ за допомогою цієї команди у вікні Ubuntu:

$ ssh-copy-id fedora_box

9

Вибачте все, це здається моєю помилкою. Я не мав

PasswordAuthentication yes

на конфігурацію SSH апарату Fedora.

Вирішили це, включивши це. Спасибі за вашу допомогу.


AFAICT yes - це значення за замовчуванням
Shubham Chaudhary

2

Для мене мені довелося прокоментувати ChallengeResponseAuthentication, але не потрібно мати парольAuthentication так.


Так, потрібно для Ubuntu 16
Max

0

Моя проблема полягала в тому, що у мене було кілька відкритих ключів і ssh-copy-idдефолт був невірний:

/usr/local/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/admin/.ssh/id_boot2docker.pub"

Коли я використовував правильний відкритий ключ, він працював:

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-machine
Використовуючи наш веб-сайт, ви визнаєте, що прочитали та зрозуміли наші Політику щодо файлів cookie та Політику конфіденційності.
Licensed under cc by-sa 3.0 with attribution required.