1. Generierung des Schlüsselpaares
you@localhost:~$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/you/.ssh/id_rsa): Created directory '/home/you/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/you/.ssh/id_rsa. Your public key has been saved in /home/you/.ssh/id_rsa.pub. The key fingerprint is: 27:e7:1f:0c:99:7d:3b:86:cb:39:91:55:5b:0d:e5:20 you@localhost The key's randomart image is: +--[ RSA 2048]----+ | E ooo| | . o+| | .+| | + .. | | S * .o. | | = ooo . | | . +.+ | | o.= . | | =. | +-----------------+
2. Erzeugung von ~/.ssh auf Remote Host (optional)
you@localhost:~$ ssh remote_user@remote.host 'mkdir -p .ssh' remote_user@remote.host's password:
3. Öffentlichen Schlüssel publizieren
you@localhost:~$ cat ~/.ssh/id_rsa.pub | ssh remote_user@remote.host 'cat >> .ssh/authorized_keys' remote_user@remote.host's password: