Заметка: ssh auth by key

Надоело каждый раз вспоминать, как делается эта простая процедура. Поэтому просто оставлю это здесь.

# ssh-keygen -t rsa -b 2048 -f $HOME/.ssh/{имя_ключа}  (обычно "id_rsa")
Enter passphrase (empty for no passphrase): **************
Enter same passphrase again: **************
Your identification has been saved in /home/user/.ssh/{имя_ключа}.
Your public key has been saved in /home/user/.ssh/{имя_ключа}.pub.
{bla bla bla}

# ssh-copy-id  -i $HOME/.ssh/{имя_ключа}.pub user@ip.ip.ip.ip
The authenticity of host 'ip.ip.ip.ip (ip.ip.ip.ip)' can't be established.
ECDSA key fingerprint is bla bla bla.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s),
to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed
-- if you are prompted now it is to install the new keys
root@ip.ip.ip.ip's password: ************
Number of key(s) added: 1
Now try logging into the machine, with:   "ssh 'root@ip.ip.ip.ip'"
and check to make sure that only the key(s) you wanted were added.

# nano $HOME/.ssh/config
> Host myvps
>    HostName ip.ip.ip.ip
>    User root

$ ssh myvps

0_0
This entry was posted in Заметки. Bookmark the permalink.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Можно использовать язык разметки Markdown

Protected by WP Anti Spam