Strona 1 z 1

SSH - pytanie o hasło przy lgowaniu przez klucze

: 19 lis 2017, 20:52
autor: lasocha
Witam
Jestem tutaj nowy, więc post umieściłem chyba w odpowiednie miejsce.

Słuchajcie mam problem i nigdzie nie mogę znaleźć odpowiedzi.
Chce połączyć ze sobą dwie maszyny z linuksem
Wygenerowałem klucze i przeniosłem publiczny na drugą maszynę z którą będę sie łączył.
Jednakże przy logowaniu wyskakuje mi komunikat z prośbą o wpisanie hasła do klucza prywatnego.
Dopiero po wpisaniu hasła loguje sie na zdalną maszynę.

Pytanie co zrobiłem nie tak?

Re: SSH - pytanie o hasło przy lgowaniu przez klucze

: 20 lis 2017, 08:54
autor: jacekalex
Albo pyta nie o hasło ale o frazę kodującą klucza (passphrase), albo coś namieszałeś w konfigu na tyle, ze masz teraz 2-factor authorization,
co jest ostatnio modne na różnych serwisach typu Google czy Facebook, ale żeby tak zadziałał serwer OpenSSH, to pierwszy raz słyszę. ;-)

Re: SSH - pytanie o hasło przy lgowaniu przez klucze

: 20 lis 2017, 12:21
autor: lasocha
jacekalex pisze: 20 lis 2017, 08:54 Albo pyta nie o hasło ale o frazę kodującą klucza (passphrase), albo coś namieszałeś w konfigu na tyle, ze masz teraz 2-factor authorization,
co jest ostatnio modne na różnych serwisach typu Google czy Facebook, ale żeby tak zadziałał serwer OpenSSH, to pierwszy raz słyszę. ;-)
W woli sprecyzowania
Enter passphrase for key '/root/.ssh/id_rsa':

Jakaś podpowiedź?

Re: SSH - pytanie o hasło przy lgowaniu przez klucze

: 20 lis 2017, 14:23
autor: jacekalex
Jeśli ustawiłeś passphrase dla klucza, to przy użyciu tego klucza musisz ją wpisać.
W przeciwnym razie na ten klucz się nie zalogujesz.

Jak chcesz się logować automatycznie kluczem ssh, to przy generowaniu klucza passphrase musi zostać pusty, nic tam nie wpisujesz.

Przykład prawidłowego logowania SSH bez passphrasy:

Kod: Zaznacz cały

ssh -v root@domek
OpenSSH_7.5p1, LibreSSL 2.6.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 60: Applying options for domek
debug1: Connecting to domek [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/pacjent/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/pacjent/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/pacjent/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/pacjent/.ssh/id_dsa-cert type -1
debug1: identity file /home/pacjent/.ssh/id_ecdsa type 3
debug1: key_load_public: No such file or directory
debug1: identity file /home/pacjent/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/pacjent/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/pacjent/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to domek:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha1 compression: zlib@openssh.com
debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha1 compression: zlib@openssh.com
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:QcgG6X+D/pysx2TpAWumKtvRdW/hjGSoDe1m+YJBvyA
debug1: Host '[domek]:22' is known and matches the ECDSA host key.
debug1: Found key in /home/pacjent/.ssh/known_hosts:5
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/pacjent/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 535
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (publickey).
Authenticated to domek ([127.0.0.1]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
Last login: Mon Nov 20 14:23:29 2017 from localhost

# G1 ###   pon lis 20 14:24:15  domek : ~ 
root ~> 
Toby było na tyle
:craz:

Re: SSH - pytanie o hasło przy lgowaniu przez klucze

: 20 lis 2017, 14:55
autor: lasocha
Wielkie dzięki za pomoc.