Aquí un pequeño tip de los que siempre he tenido tener guardados y nunca lo he hecho.
Se trata de un script para generar exportar tu clave pública a otra máquina y no tener que introducir tu contraseña a la hora de acceder por SSH.
Lo primero, antes que nada es:
cd ~ && ssh-keygen -t dsa
Y decir que sí a todo e introducir una frase vacía , sin caracteres.
Hecho esto os podéis copiar este script (fuente) y modificar USERNAME por vuestro nombre de usuario.
#!/bin/bash
## USAGE: add_to_server.sh remote_server
## This script will add your ssh dsa public key to remote_server's authorized_keys list,
## assuming that everything is in it's default location
set -v # verbose output
username="USERNAME" # CHANGE ME!!!!
remote_server=$1 # assigns the first commandline argument to $remote_server
## Pipe the public key to ssh, then remotely touch the file to make sure it will be there, and concat to the end of it.
## Might work without the touch?
cat ~/.ssh/id_dsa.pub | ssh ${username}@${remote_server} "touch ~/.ssh/authorized_keys && cat - >> ~/.ssh/authorized_keys"
exit 0
Hecho esto ya lo podéis utilizar con la siguiente sintaxis:
$ add_to_server.sh IP_de_host

Yo lo hice el otro día, siguiendo las indicaciones del fantástico wiki de Dreamhost. Mucho más cómodo :D
Me ha funcionado a la perfección... viva!!
Pero, usando una frase vacía sin caractres, ¿no estamos perdiendo seguridad por algún sitio?
Sí, hay que tener especial cuidado con que esa máquina sea segura: capar puertos, restringir usuarios y demás medidas de seguridad.
Un post reciente en el que hablan del tema: Combinando SSH, cron y at