The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

форумы  помощь  поиск  регистрация  майллист  вход/выход  слежка  RSS
"Не подключается к ssh через ключ"
Вариант для распечатки  
Пред. тема | След. тема 
Форум Открытые системы на сервере (Др. сетевые сервисы)
Изначальное сообщение [ Отслеживать ]

"Не подключается к ssh через ключ"  –1 +/
Сообщение от tux13 (ok) on 18-Июн-15, 22:19 
На сервере Ubuntu 14.04, на клиенте 15.04
Все как обычно, на стороне клиента:
ssh-keygen -t rsa
ssh-copy-id -p 2222 -i ~/.ssh/id_rsa.pub user@server

на стороне сервера в sshd_config:
Port 2222
Protocol 2
PublickeyAuthentication yes

Пробую зайти на сервер

ssh -p 2222 user@server

и вижу приглашение ввести пароль !!!

До переустановки системы на клиенте (с 14.10 на 15.04) все работало как часы ... Что изменилось? Куда копать?

sshd_config

Port 2222
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
lengeResponseAuthentication to 'no'.
UsePAM yes

ssh -vv

user@server:~$ ssh -p 2222 -vv user@server
OpenSSH_6.7p1 Ubuntu-5ubuntu1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to server [192.168.0.1] port 2222.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup umac-64-etm@openssh.com
debug1: kex: server->client aes128-ctr umac-64-etm@openssh.com none
debug2: mac_setup: setup umac-64-etm@openssh.com
debug1: kex: client->server aes128-ctr umac-64-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 24:bb:d3:1e:8e:99:11:a1:f3:aa:1b:f5:ad:d1:d7:1f
debug1: Host '[server]:22' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:1
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/user/.ssh/id_rsa (0x7f72a80771b0),
debug2: key: /home/user/.ssh/id_dsa ((nil)),
debug2: key: /home/user/.ssh/id_ecdsa ((nil)),
debug2: key: /home/user/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/user/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Trying private key: /home/user/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
user@server's password:
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to server ([192.168.0.1]:2222).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/user
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: Sending env LANG = ru_RU.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-39-generic x86_64)

* Documentation:  https://help.ubuntu.com/

  System information as of Sun Jun  7 11:14:15 MSK 2015

  System load:  0.22                Processes:             144
  Usage of /:   56.7% of 284.81GB   Users logged in:       0
  Memory usage: 12%                 IP address for eth0:   192.168.0.1
  Swap usage:   0%                  IP address for virbr0: 192.168.122.1

  Graph this data and manage this system at:
    https://landscape.canonical.com/

97 packages can be updated.
64 updates are security updates.

Last login: Sat Jun  6 20:43:08 2015 from 192.168.0.244
user@server:~$

P.S. Права естественно 700 и 600 и файл authorized_keys создался и ключ в нем прописался ...Все как обычно.

Ответить | Правка | Cообщить модератору

Оглавление

Сообщения по теме [Сортировка по времени | RSS]


1. "Не подключается к ssh через ключ"  +/
Сообщение от Square (ok) on 18-Июн-15, 22:27 
> На сервере Ubuntu 14.04, на клиенте 15.04
> Все как обычно, на стороне клиента:
>
ssh-keygen -t rsa 
> ssh-copy-id -p 2222 -i ~/.ssh/id_rsa.pub user@server

> P.S. Права естественно 700 и 600 и файл authorized_keys создался и ключ
> в нем прописался ...Все как обычно.

debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/user

Ответить | Правка | ^ к родителю #0 | Наверх | Cообщить модератору

2. "Не подключается к ssh через ключ"  +/
Сообщение от tux13 (ok) on 19-Июн-15, 00:06 
>> На сервере Ubuntu 14.04, на клиенте 15.04
>> Все как обычно, на стороне клиента:
>>
ssh-keygen -t rsa 
>> ssh-copy-id -p 2222 -i ~/.ssh/id_rsa.pub user@server

>> P.S. Права естественно 700 и 600 и файл authorized_keys создался и ключ
>> в нем прописался ...Все как обычно.
> debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/user

Спасибо за оперативный ответ. Нашел причину в ssh_config:

StrictModes yes

а нужно
StrictModes no

Ответить | Правка | ^ к родителю #1 | Наверх | Cообщить модератору

3. "Не подключается к ssh через ключ"  +/
Сообщение от Square (ok) on 19-Июн-15, 01:51 
>[оверквотинг удален]
>>> Все как обычно, на стороне клиента:
>>>
ssh-keygen -t rsa 
>>> ssh-copy-id -p 2222 -i ~/.ssh/id_rsa.pub user@server

>>> P.S. Права естественно 700 и 600 и файл authorized_keys создался и ключ
>>> в нем прописался ...Все как обычно.
>> debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/user
> Спасибо за оперативный ответ. Нашел причину в ssh_config:
>
StrictModes yes

> а нужно
>
StrictModes no

Эт вы зря.
Во первых лучше убрать PermitRootLogin without-password
то есть поставить PermitRootLogin no  или в крайнем случае PermitRootLogin yes
а во вторых лучше проверить юзера и права доступа на хом каталог юзера, чем отрезать StrictModes.

Ответить | Правка | ^ к родителю #2 | Наверх | Cообщить модератору

4. "Не подключается к ssh через ключ"  +/
Сообщение от pavel_simple (ok) on 19-Июн-15, 05:17 
>[оверквотинг удален]
>>> debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/user
>> Спасибо за оперативный ответ. Нашел причину в ssh_config:
>>
StrictModes yes

>> а нужно
>>
StrictModes no

> Эт вы зря.
> Во первых лучше убрать PermitRootLogin without-password
> то есть поставить PermitRootLogin no  или в крайнем случае PermitRootLogin yes
> а во вторых лучше проверить юзера и права доступа на хом каталог
> юзера, чем отрезать StrictModes.

политака относительно PermitRootLogin это отдельная песня, а вот права на home нужно поправить и strictmodes поставить в yes

Ответить | Правка | ^ к родителю #3 | Наверх | Cообщить модератору

5. "Не подключается к ssh через ключ"  +/
Сообщение от tux13 (ok) on 19-Июн-15, 10:51 
>[оверквотинг удален]
>>> debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/user
>> Спасибо за оперативный ответ. Нашел причину в ssh_config:
>>
StrictModes yes

>> а нужно
>>
StrictModes no

> Эт вы зря.
> Во первых лучше убрать PermitRootLogin without-password
> то есть поставить PermitRootLogin no  или в крайнем случае PermitRootLogin yes
> а во вторых лучше проверить юзера и права доступа на хом каталог
> юзера, чем отрезать StrictModes.

Так права все выставлены были ... сразу. Проверял не единожды :(

Ответить | Правка | ^ к родителю #4 | Наверх | Cообщить модератору

6. "Не подключается к ssh через ключ"  +/
Сообщение от Аноним (??) on 20-Июн-15, 20:52 
>> а во вторых лучше проверить юзера и права доступа на хом каталог
>> юзера, чем отрезать StrictModes.
> Так права все выставлены были ... сразу. Проверял не единожды :(

selinux \ apparmor ?

Ответить | Правка | ^ к родителю #5 | Наверх | Cообщить модератору

Архив | Удалить

Рекомендовать для помещения в FAQ | Индекс форумов | Темы | Пред. тема | След. тема




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру