SayIT
22 May 2012, 08:24 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
  Home   Forum   Help Login Register   *
  Ştiri
   Hardware
   Software
   Internet
   Jocuri
   Diverse
  
  Teste şi prezentări
   Procesoare
   Plăci de bază
   Memorii
   Plăci video
   Diverse
   Software & Jocuri
Mesaje recente
[19 May 2012, 23:56]

[19 May 2012, 17:53]

[19 May 2012, 16:39]

[17 May 2012, 17:00]

by LNT
[17 May 2012, 10:18]

[16 May 2012, 18:52]

[08 May 2012, 09:14]

[08 May 2012, 09:12]
Members
Total Members: 360
Latest: Emeraldu
Stats
Total Posts: 17510
Total Topics: 1216
Online Today: 12
Online Ever: 233
(26 June 2007, 07:28)
Users Online
Users: 0
Guests: 12
Total: 12
Pages: [1]   Go Down
  Print  
This topic has not yet been rated!
You have not rated this topic. Select a rating:
Author Topic: CentOS 4.6 Autentificare SSH via keys only  (Read 422 times)
0 Members and 2 Guests are viewing this topic.
Praetor Offline
Green,bad and (not so) ugly ogre

Cookies: 12
Posts: 142
« on: 27 February 2008, 19:10 »

Bun. Incerc pe CentOs-ul din vmware sa fac operatiunea din titlu doar ca sa ma trezesc cu permission denied.
Am facut asa (Logat ca userul test)
1. ssh-keygen -t rsa
a. lasat default id_rsa
b. pus passphrase
2. copiat id_rsa in authorize_keys
3. chmod 700 .ssh
chmod 600 ./ssh/authorize_keys
4. ssh 127.0.0.1
duce la permission denied (publickey, keyboard-interactive).

Oricat m-as juca cu setarile din sshd nimic.
Initial vroiam sa ma conectez cu putty unde imi tot daduse aceeasi problema asa c-am incercat sa vad daca local merge si n-a mers.

So need help.
Ignore user   Logged
~Empathy~ Offline
...distressed...


Cookies: 32
Posts: 432
« Reply #1 on: 27 February 2008, 21:27 »

Whoa? Dubios ce ai facut tu acolo si vag. O parte din comenzile alea trebuie date pe client, iar alta parte pe server -- la tine e ketchup.

Fa ce scrie aici si nu ai cum sa gresesti:
http://sial.org/howto/openssh/publickey-auth/
Ignore user   Logged

We dance, and the music dies...
Praetor Offline
Green,bad and (not so) ugly ogre

Cookies: 12
Posts: 142
« Reply #2 on: 27 February 2008, 23:17 »

Nu e ketchup. Am generat keys apoi m-am conectat la localhost cu ele pt test. Btw am citit cel putin 5 tutoriale pe tema asta in care spunea ce-am scris eu mai sus.

Am mai incercat si sa generez cheia in puttygen apoi pus publicul pe linux, conectat cu putty. Same sh** (adica nu merge).
Ignore user   Logged
~Empathy~ Offline
...distressed...


Cookies: 32
Posts: 432
« Reply #3 on: 28 February 2008, 11:26 »

Da-mi acces remote la server, da-mi acces remote la client si fac eu tot ce trebuie :P.
Ignore user   Logged

We dance, and the music dies...
kman Offline
God of the code-monkeys


Cookies: 24
Posts: 192
« Reply #4 on: 28 February 2008, 11:41 »

Daca ai copiat id_rsa in authorized_keys n-ai facut nimic ca tu ai copiat cheia privata, trebuie sa pui id_rsa.pub in authorized keys.

De asemenea in sshd_config trebuie sa ai urmatoarele chestii setate:
Code:
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

AuthorizedKeysFile e optional dupa cum se vede, in exemplul meu e comentat.
Ignore user   Logged
Praetor Offline
Green,bad and (not so) ugly ogre

Cookies: 12
Posts: 142
« Reply #5 on: 28 February 2008, 11:59 »

E in vmware acolo experimentez. Si nu vad de ce e o problema daca acelasi linux e si client si server. O sa mai incerc zilele astea, acum am altele pe cap (configurare de postfix si bla).

@kman:
Eu stiam c-am copiat cheia publica. M-am uitat acum si da e cea publica. Am scris gresit in primul post. si-n sshd.conf sint setarile alea.
Am facut paste la o noua incercare. Sint activate si autentificare prin keys si prin parola. CUm keys nu merge am dat parola gresita pana a dat mesajul cu permission denied. IN mod normal ar fi fost dezactivat login prin parola dar am facut operatiunea prin ssh si trebuia sa ma logez cumva.

Quote
[test@nutrielle ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/test/.ssh/id_rsa.
Your public key has been saved in /home/test/.ssh/id_rsa.pub.
The key fingerprint is:
33:34:23:04:d4:d7:79:77:e8:fd:e4:28:17:f4:a7:f7 test@nutrielle.com
[test@nutrielle ~]$ cd ~/.ssh
[test@nutrielle .ssh]$ cp id_rsa.pub authorize_keys
[test@nutrielle .ssh]$ ls -l
total 12
-rw-r--r--  1 test test 228 Feb 27 21:04 authorize_keys
-rw-------  1 test test 963 Feb 27 21:04 id_rsa
-rw-r--r--  1 test test 228 Feb 27 21:04 id_rsa.pub
[test@nutrielle .ssh]$ chmod 600 authorize_keys
[test@nutrielle .ssh]$ ls -l
total 12
-rw-------  1 test test 228 Feb 27 21:04 authorize_keys
-rw-------  1 test test 963 Feb 27 21:04 id_rsa
-rw-r--r--  1 test test 228 Feb 27 21:04 id_rsa.pub
[test@nutrielle .ssh]$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is 84:4f:72:56:64:37:11:22:c2:25:d9:78:45:1c:61:b2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
test@127.0.0.1's password:
Permission denied, please try again.
test@127.0.0.1's password:
Permission denied, please try again.
test@127.0.0.1's password:
Permission denied (publickey,password).
[test@nutrielle .ssh]$

Daca as fi introdus parola m-ar fi logat fara probleme. Dar scopul e sa fac asta via keys...
Ignore user   Logged
kman Offline
God of the code-monkeys


Cookies: 24
Posts: 192
« Reply #6 on: 28 February 2008, 14:43 »

[test@nutrielle ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/test/.ssh/id_rsa.
Your public key has been saved in /home/test/.ssh/id_rsa.pub.
The key fingerprint is:
33:34:23:04:d4:d7:79:77:e8:fd:e4:28:17:f4:a7:f7 test@nutrielle.com
[test@nutrielle ~]$ cd ~/.ssh
[test@nutrielle .ssh]$ cp id_rsa.pub authorize_keys
[test@nutrielle .ssh]$ ls -l
total 12
-rw-r--r--  1 test test 228 Feb 27 21:04 authorize_keys
-rw-------  1 test test 963 Feb 27 21:04 id_rsa
-rw-r--r--  1 test test 228 Feb 27 21:04 id_rsa.pub
[test@nutrielle .ssh]$ chmod 600 authorize_keys
[test@nutrielle .ssh]$ ls -l
total 12
-rw-------  1 test test 228 Feb 27 21:04 authorize_keys
-rw-------  1 test test 963 Feb 27 21:04 id_rsa
-rw-r--r--  1 test test 228 Feb 27 21:04 id_rsa.pub
[test@nutrielle .ssh]$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is 84:4f:72:56:64:37:11:22:c2:25:d9:78:45:1c:61:b2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
test@127.0.0.1's password:
Permission denied, please try again.
test@127.0.0.1's password:
Permission denied, please try again.
test@127.0.0.1's password:
Permission denied (publickey,password).
[test@nutrielle .ssh]$


de fapt e authorized_keys
« Last Edit: 28 February 2008, 16:08 by kman » Ignore user   Logged
Praetor Offline
Green,bad and (not so) ugly ogre

Cookies: 12
Posts: 142
« Reply #7 on: 28 February 2008, 15:15 »

Seems to work :D nu-=mi vine sa cred ca era un typo. Oricum acum vreau sa-l fac sa mearga si din win cu putty. Revin cu detalii

Intre timp m-am prins de ce nu mergea auth din putty. Trebuie passphrase> 4 (daca ai parola) . Cand generezi pe linux te obliga, dar la puttygen nu zice nimic.

Deci am reusit. Inca e un pic voodoo ca practic ultimele 2 dati am incercat cu putty, prima oara failed a doua oara a mers cu aceleasi key.

Anyway, merci kman e uimitor cum n-am observat typo-ul ala atata timp.
« Last Edit: 28 February 2008, 16:14 by Praetor » Ignore user   Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!