All Guides

Создание SSH-ключей

Создайте пару SSH-ключей для безопасного подключения к серверам.

Beginner10 мин.

Setup Steps

1. Generate an SSH key pair:

ssh-keygen -t ed25519 -C "email@example.com"

2. Accept the default location (~/.ssh/id_ed25519)

3. Set a passphrase (recommended)

4. View the public key:

cat ~/.ssh/id_ed25519.pub

5. Copy the key to the server:

ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server_ip

6. Now you can connect without a password:

ssh user@server_ip

7. Create an SSH config file (~/.ssh/config):

Host myserver
    HostName 192.168.1.100
    User username
    Port 22
    IdentityFile ~/.ssh/id_ed25519

8. Connect with a short command:

ssh myserver

9. SSH agent usage:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

10. Add SSH key to GitHub:

GitHub > Settings > SSH and GPG keys > New SSH key