Ya hemos visto que es muy interesante configurar nuestro acceso ssh para que no nos solicite una contraseña, un ejemplo es en la Instalación de Hadoop, para ello deberemos crear un archivo llamado authorized_keys2 en el host al cual queremos conectarnos utilizando la clave pública que hemos creado, normalmente el archivo id_rsa.pub
Generamos las claves RSA en el host origen
$ ssh-keygen -t rsa -b 2048 -C "MacBook Key"Nos conectamos al host destino y creamos el archivo authorized_keys2 en el directorio $HOME/.ssh
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/itily/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/itily/.ssh/id_rsa.
Your public key has been saved in /Users/itily/.ssh/id_rsa.pub.
The key fingerprint is:
00:eb:04:fa:31:20:3b:0a:41:52:ae:30:9e:bb:c3:05 MacBook Key
The key's randomart image is:
+--[ RSA 2048]----+
|*oo . |
|o* . o |
|B + o . |
|=E.= . |
|ooo . S |
| .. |
|... |
| o. |
| .. |
+-----------------+
$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvRSEmi4Nk2+hIbztxBbzJDEoT/s9iJhN7oQdXfjRsBcX8L1xcpRCWiAObqBVTBu2XOc0yrb5aG/1SLaQrOiz0Cq1uKDgxZ8A5ZdMk328zKSVHsPSH3wXDB9z+oshjXSXWM4aJ0k4AI/qbGfeFRT+kNdDK4GjXtEoF+PNDtd1QOBaXP3GBhxGLJ85XViSrUHDAlAiJm28xCQa1kIXXRuiynDoVO1BY0Wy2CPq5HPgKddthmtwvhh3+2dvcRPyumgvyIIu+nHGv+BKPBGRVMObSSNlnSmGR8pIMVekcw8xGYbAvofueDAkLAVil9WBEpO9v25am9EEc2/skdF2PTfpmQ== MacBook Key
$ ssh osiris.sfchildren.comComprobamos que nos conectamos correctamente
Password:
Last login: Tue Sep 8 00:57:52 2009 from MacBookPro
Osiris:~ itily$ vi $HOME/.ssh/authorized_keys2
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvRSEmi4Nk2+hIbztxBbzJDEoT/s9iJhN7oQdXfjRsBcX8L1xcpRCWiAObqBVTBu2XOc0yrb5aG/1SLaQrOiz0Cq1uKDgxZ8A5ZdMk328zKSVHsPSH3wXDB9z+oshjXSXWM4aJ0k4AI/qbGfeFRT+kNdDK4GjXtEoF+PNDtd1QOBaXP3GBhxGLJ85XViSrUHDAlAiJm28xCQa1kIXXRuiynDoVO1BY0Wy2CPq5HPgKddthmtwvhh3+2dvcRPyumgvyIIu+nHGv+BKPBGRVMObSSNlnSmGR8pIMVekcw8xGYbAvofueDAkLAVil9WBEpO9v25am9EEc2/skdF2PTfpmQ== MacBook Key
:wq
Osiris:~ itily$ exit
$ ssh osiris.sfchildren.com
Last login: Tue Sep 8 00:58:08 2009 from MacBookPro
Osiris:~ itily$ exit
Referencias
No hay comentarios:
Publicar un comentario