Jak naprawić błąd Odmowa dostępu (klucz publiczny)?


11

Próbując komunikować się między moim komputerem Ubuntu 12.10 a Fedorą 19, mam do czynienia z błędem Odmowa dostępu (klucz publiczny) .
Jestem w stanie zalogować się przez ssh z Fedory do Ubuntu, ale nie odwrotnie.
Wykonałem nawet telnet na obu komputerach przez port 22 i oba urządzenia nasłuchują, ale nie przez ssh. Co robić? Dowolny pomysł?

Mój sshd_configplik jest następujący:

# 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

To jest sshd_config systemu ubuntu.

ssh -v fedora_machine



Który to komputer sshd_configz Ubuntu lub Fedory? Czy możesz również dodać transkrypcję tego, co dzieje się, gdy jesteś ssh -v fedora_machinena komputerze z Ubuntu?
— David Purdue

sshd_config jest z Ubuntu Właśnie podałem @DavidPurdue ssh -v fedora_mch w pytaniu.
— Vivek Singh

Odpowiedzi:


14

Jak już zauważyłeś, okno Fedory, do którego się logujesz, nie zostało skonfigurowane tak, aby zezwalać na uwierzytelnianie hasłem, a jedynie na uwierzytelnianiu za pomocą klucza publicznego - można to zobaczyć na podstawie ssh -vwyniku.

Tak więc jednym z rozwiązań jest dodanie uwierzytelnienia hasła, tak jak zostało to zrobione.

Inną metodą byłoby pobranie zawartości ~/.ssh/id_rsa.pubw polu Ubuntu i dodanie jej do pliku ~/.ssh/authorized_keysw oknie Fedory.

Teraz, gdy masz włączone uwierzytelnianie za pomocą hasła, możesz zainstalować autoryzowany klucz za pomocą tego polecenia w polu Ubuntu:

$ ssh-copy-id fedora_box

9

Przepraszam wszystkich, wydaje się, że to mój błąd. nie miałem

PasswordAuthentication yes

na konfiguracji SSH maszyny Fedory.

Rozwiązano to, włączając to. Dzięki za pomoc.


AFAICT tak jest wartością domyślną
— Shubham Chaudhary

2

Dla mnie musiałem skomentować ChallengeResponseAuthentication nie na górze po włączeniu PasswordAuthentication tak.


Tak, wymagane w systemie Ubuntu 16
— maks

0

Mój problem polegał na tym, że miałem wiele kluczy publicznych i ssh-copy-iddomyślnie użyłem niewłaściwego:

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

Gdy użyłem poprawnego klucza publicznego, zadziałało:

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-machine
Korzystając z naszej strony potwierdzasz, że przeczytałeś(-aś) i rozumiesz nasze zasady używania plików cookie i zasady ochrony prywatności.
Licensed under cc by-sa 3.0 with attribution required.