Создаём пару ключей (публичный и приватный) на локальной машине. Вместо пароля жмём Enter (удобно для безпарольной авторизации по ssh).

[root@dev2 ~]# ssh-keygen  -t dsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b8:5d:63:6b:98:09:b9:48:f0:9d:b1:91:fa:22:e1:3d root@dev2

Теперь копируем свой публичный ключ ssh на удалённую машину в список допустимых ключей.

[root@dev2 .ssh]# ssh-copy-id -i ~/.ssh/id_rsa.pub localhost
21
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is 24:e5:61:b4:26:72:9e:fa:c9:d0:76:93:c4:49:05:ba.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
root@localhost's password:
Now try logging into the machine, with "ssh 'localhost'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

теперь по команде ssh localhost мы без ввода паролей сможем зайти на сервер localhost.

примечание: Замените localhost на хостнэйм/ip удалённой машины.

sozdanie_ssh_kljucha_na_udaljonnyj_server.txt · Последние изменения: 2013/10/23 15:30 (внешнее изменение)
GNU Free Documentation License 1.3
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Яндекс.Метрика