Quick and dirty SSH Public Key Authentication

quick_and_dirty_ssh_public_key_authentication

Every time I want to setup public key authentication over SSH I use this simplest guide. Today, I decided to share it.

Create a key pair on local machine:
$ ssh-keygen -t rsa

Output:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dima/.ssh/id_rsa):

It will ask you for a passphrase. Enter a sequence of any characters to protect the key.

Output:
Enter passphrase (empty for no passphrase): y0urp@$$phr@se
Enter same passphrase again: y0urp@$$phr@se

Check if the public/private rsa key pair exists:
$ ls ~/.ssh/*rsa*

Output:
/home/user/.ssh/id_rsa
/home/user/.ssh/id_rsa.pub

id_rsa - the private rsa key. which must never be made available to anyone
id_rsa.pub - the public rsa key, which can be distributed to other computers

Copy your public key to the remote server:
sftp your.remote.server.net
sftp> mkdir .ssh
sftp> put .ssh/id_rsa.pub .ssh/authorized_keys2

Now you can connect via SSH to your remote server:
ssh -v your.remote.server.net


Sursa
2009-03-06 16:23:03



Comenteaza





Ultimele 25 posturi adăugate

08:13:07Mundus Vini: un vin surpriză ia titlul „Best of show Moldova sparkling” —» Fine Wine
17:59:00DIALOG DESPRE ARTA TRADUCERII —» Leo Butnaru
07:32:02Arhitectura unui brand personal sau profesional: între substanță, diferențiere și încredere —» Efrosnatalita’s Blog
06:08:00DIN COSMOGRAME —» Leo Butnaru
21:41:54Industria calului în galop —» APort | "Pentru un român care știe citi, cel mai greu lucru e să nu scrie." I.L. Carag
18:50:24Vai sărmana turturică… adăpostită la Purcari! —» Fine Wine
11:55:26Mărțișor, 2026 —» CHIŞINĂU MUZICAL | Blogul Bibliotecii de Arte "Tudor Arghezi"
06:09:00VIN SĂRBĂTORILE —» Leo Butnaru
06:39:00DIN POEZIA LUMII —» Leo Butnaru
07:42:00Женское счастье. —» Александр Ищенко - Размышления
06:38:00MINISTERUL... MISTERIULUI —» Leo Butnaru
07:09:00Alone —» Andrei LANGA. Blogul personal
06:15:00REFLECȚII —» Leo Butnaru
17:18:00Calea Lactee —» Andrei LANGA. Blogul personal
07:24:00DIN POEZIA EUROPEI —» Leo Butnaru
12:24:29Bastus si Gerula —» APort | "Pentru un român care știe citi, cel mai greu lucru e să nu scrie." I.L. Carag
13:16:00Haină —» Andrei LANGA. Blogul personal
11:57:00Antarctida —» Andrei LANGA. Blogul personal
05:25:00DIN POEZIA FRANCEZĂ —» Leo Butnaru
06:02:00DIN REVISTA TINERILOR —» Leo Butnaru
06:05:00POEME —» Leo Butnaru
13:33:00Arcadie Zaporojanu face azi 60 de ani! —» Sandu GRECU
13:08:00Life happens. —» Ghiocika
11:30:09Muzicologul Efim Tcaci —» Biblioteca de Arte 'Tudor Arghezi'
10:49:00A fi istoric! —» Biblioteca de Arte 'Tudor Arghezi'