LINUX.ORG.RU

Аутентификация по ключу в SSH


0

0

Не могу настроить аутентификацию по ключу в SSH.
Вот последовательность действий:
Запускаю ssh-keygen -t rsa -b 2048 -f $HOME/.ssh/id_rsa
Переименовываю id_rsa.pub в autрorized_keys
Запускаю с этого же компьютера ssh -i id_rsa login@server
Он, зараза, сразу просит пароль. Пытаюсь сделать то же через putty, предварительно сгенерировав ключи, он выдает
Server refused your key
Что я сделал не так?

delluge (*) (06.05.2

Ты это, сгенерированный ключ на целевую машину кидаешь, или он у тебя остаётся на той же, откуда логинишься? Внимательнее читай доки - это тривиальное дело.. Если не получается, значит что-то ты не так делаешь..

MiracleMan ★★★★★
()
Ответ на: комментарий от MiracleMan

Я делаю в точности то, что написано здесь
http://www.security-teams.net/index.php?s=aba3be10c40bffe134d952a45f95cc46&am...
Конфигурационный файл:

Port 22
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

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

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile $HOME/.ssh/authorized_keys

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

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# 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 mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server

delluge
() автор топика

Покажи, какие у тебя права и кто владелец:

1) директории ~/.ssh на машине, куда пытаешься законнектиться 2) файла ~/.ssh/authorized_keys (там же)

Vond ★★
()
Ответ на: комментарий от Vond

Вот файл /var/log/auth/all

May 11 10:14:08 apple sshd[17013]: debug1: Forked child 17829.
May 11 10:14:08 apple sshd[17829]: debug1: inetd sockets after dupping: 3, 3
May 11 10:14:08 apple sshd[17829]: Connection from 192.168.0.23 port 2037
May 11 10:14:08 apple sshd[17829]: debug1: Client protocol version 2.0; client software version PuTTY_Release_0.58
May 11 10:14:08 apple sshd[17829]: debug1: no match: PuTTY_Release_0.58
May 11 10:14:08 apple sshd[17829]: debug1: Enabling compatibility mode for protocol 2.0
May 11 10:14:08 apple sshd[17829]: debug1: Local version string SSH-2.0-OpenSSH_4.3
May 11 10:14:08 apple sshd[17829]: Failed none for vladimir from 192.168.0.23 port 2037 ssh2
May 11 10:14:08 apple sshd[17829]: debug1: temporarily_use_uid: 825/825 (e=0/0)
May 11 10:14:08 apple sshd[17829]: debug1: trying public key file /home/vladimir/$HOME/.ssh/authorized_keys
May 11 10:14:08 apple sshd[17829]: debug1: restore_uid: 0/0
May 11 10:14:08 apple sshd[17829]: debug1: temporarily_use_uid: 825/825 (e=0/0)
May 11 10:14:08 apple sshd[17829]: debug1: trying public key file /home/vladimir/$HOME/.ssh/authorized_keys
May 11 10:14:08 apple sshd[17829]: debug1: restore_uid: 0/0

delluge
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.