Introduction

A protocol

Login

Normal login:

ssh username@server_ip

SSH Keys (Password-less Login)

Instead of typing password every time, we use SSH keys.

  1. Generate SSH key on your local machine:

    ssh-keygen -t ed25519 -f deploy_key
    # ssh-keygen    : cmd to generate a new SSH key pair
    #	-t ed25519    : modern type of SSH key algorithm
    #	-f deploy_key : custom file name, to save the key in local
    
  2. Get two files on local:

    1. deploy_key → private key, keep secret! 🔒 (as identity)
    2. deploy_key.pub → public key, share to server 🌐 (to verify u)
    C:\\Users\\Minhen\\.ssh\\
        id_ed25519        (PRIVATE KEY)
        id_ed25519.pub    (PUBLIC KEY)
    
  3. Copy public key to VPS:

    mkdir -p ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
    
  4. Will into a text area, then paste contents of deploy_key.pub into it