Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Witam.
ostatnio skonfigurowałem sobie ssh , wszystko pięknie smiga , chciałem ustawic logowanie przez klucz rsa.
Oto co zrobiłem :
komp 1 - moj komputer (klient)
komp 2 - serwer
1. na kompie 1 wpisałem , ssh-keygen -t rsa , wpisałem passphrase
2. z kompa 1 skopiowałem plik id_rsa.pub na kompa 2 za pomocą : scp id_rsa.pub grom120@192.168.20.243:/home/grom120
3. wykonałem na kompie 2 , cat id_rsa.pub >> /.ssh/authorized_keys
4. zmieniłem ustawienia na takie :
komp 1 :
Host * # ForwardAgent no # ForwardX11 no # ForwardX11Trusted yes # RhostsRSAAuthentication no RSAAuthentication yes # PasswordAuthentication no # HostbasedAuthentication no # GSSAPIAuthentication no # GSSAPIDelegateCredentials no # GSSAPIKeyExchange no # GSSAPITrustDNS no # BatchMode no # CheckHostIP yes # AddressFamily any # ConnectTimeout 0 # StrictHostKeyChecking ask IdentityFile ~/.ssh/identity IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 # Protocol 2 # Cipher 3des # Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc # MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160 # EscapeChar ~ # Tunnel no # TunnelDevice any:any # PermitLocalCommand no SendEnv LANG LC_* HashKnownHosts yes # GSSAPIAuthentication yes # GSSAPIDelegateCredentials no
komp 2 :
# What ports, IPs and protocols we listen for Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress :: #Listencd Address 192.168.20.243 Protocol 2 # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_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 30 PermitRootLogin no StrictModes yes RSAAuthentication yes PubkeyAuthentication no AuthorizedKeysFile %h/.ssh/authorized_keys # Don't read the user's ~/.rhosts and ~/.shosts files IgnoreRhosts yes AllowUsers * # 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 no # Kerberos options #KerberosAuthentication no #KerberosGetAFSToken no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes X11Forwarding no X11DisplayOffset 10 PrintMotd yes 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 UsePAM yes
przy próbie logowania ssh grom120@192.168.20.243 , serwer pyta o hasło , wpisuje i pisze permission denied , czemu ssh nie uzywa w tym momencie klucza rsa ?
Offline
Offline
zrobiłem praktycznie tak samo , to powinno działac , ale nie wiem czemu serwer nie korzysta z uwierzytelniania Rsa , moze cos w konfigu /etc/ssh/sshd_config?
edit: serwer pyta o password a nie o passphrase ;/
edit : próba logowania w trybie gadatliwym :
OpenSSH_5.1p1 Debian-8, OpenSSL 0.9.8k 25 Mar 2009 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to 192.168.20.243 [192.168.20.243] port 22. debug1: Connection established. debug1: identity file /home/drops120/.ssh/identity type -1 debug1: identity file /home/drops120/.ssh/id_rsa type 1 debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5 debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-8 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host '192.168.20.243' is known and matches the RSA host key. debug1: Found key in /home/drops120/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: debug1: Next authentication method: publickey debug1: Offering public key: /home/drops120/.ssh/id_rsa debug1: Authentications that can continue: debug1: Trying private key: /home/drops120/.ssh/identity debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: debug1: Next authentication method: password
Ostatnio edytowany przez grom120 (2009-12-22 21:50:11)
Offline
tak zrestartowałem /etc/init.d/ssh restart ,
próbowałem taką komendą
ssh -i ~/.ssh/id_rsa -2 -o PreferredAuthentications=publickey grom120@192.168.20.243
no i nadal nic ... pisze
permission denied (publickey)
Ostatnio edytowany przez grom120 (2009-12-23 08:38:10)
Offline
grom120 zeby sie logować tylko za pomocą kluczy (bez pass phrase) to są dwie opcje.
Primo: Podczas towrzenia klucza RSA podaj puste pass phrase - opcja mało elegancka
Secundo: skorzystaj z ssh-agent.
Jak skonfigurować tego drugiego jest w linku, który podał Ci giegiel. Obie opisane tam metody działaja - testowałem u siebie zanim opublikowałem ;]
Offline
wczoraj kopałem 5 h w google , znalazłem kilka podobnych przypadków , ale niestety zadne rozwiązania nie pomagają ;/ moze ktos z was miał podobny problem ...
Offline
Co do połączeń po ssh między kompami - polecam raz jeszcze art. z jakilinux.org - sprawdzony i pewny sposób (nie deprecjonuję DUGowego FAQa, po prostu nie korzystałem zeń).
Samą konfigurację ssh (ssh_conf i sshd_conf) przeprowadzałem wg podręcznika dla siduksa - wrzuć w googla, tam jest to dość przystępnie wyjaśnione.
Offline
dokładnie tak samo robiłem jak w tym artykule na jakilinux.org ; / wnerwia mnie ta niemoznosc logowania przez RSA
edit : winnetou narazie to chciałbym aby SSH zaczął uwierzytelniac przez RSA , pozniej zajme sie logowaniem bez passphrase , próbowałem róznych sposobów , bez podawania passphrase i tez nic ;/ wyskakuje permission denied(publickey)
Ostatnio edytowany przez grom120 (2009-12-23 10:46:09)
Offline
tak - zezwoliłem na wszystko , uwierzytelnianie przez password smiga
Offline
grom120 napisał(-a):
tak - zezwoliłem na wszystko ...
Lepiej wszystkiego zabronić i dać wyjątki - IMO
Offline
grom120 jeszcze taki trick:
chmod 700 ~/.ssh chmod 600 ~/.ssh/*
Jak wspominałem w arcie niektóre serwery odmawiają współpracy jeżeli prawa do katalogów są zbyt duże - nie obczailem jeszcze co w konfigu za to odpowiada ;)
Offline
niestety to tez zrobiłem ;/ zastosowałem sie do wszystkich twoich wskazówek z arta i paru innych z innych stron :
http://sial.org/howto/openssh/publickey-auth/
http://www.eng.cam.ac.uk/help/jpmg/ssh/authorized_keys_howto.html
i **** chujnia z grzybnią i patatajcem ... nie mam juz pomysłów , przez dsa tez próbowalem i nic
Offline
hm, to znaczy że ssh działa :)
Serio - sprawdź wpisy, ja miałem błąd w /etc/host/allow - literówkę, a właściwie cyfrówkę i też mnie szlag trafiał, bo nie mogłem trzeciej maszyny podłączyć...
Offline