2 min read
Unix SSH

SSH setup guide for Unix systems

About

This is a guide for setting up SSH on Unix systems. This guide assumes that the SSH server is running on a Unix system and the client is also a Unix system.

Server Setup

  1. Install SSH server

    # Arch
    sudo pacman -S openssh
    
    # Ubuntu
    sudo apt install openssh-server
  2. Start SSH server

    sudo systemctl start sshd
    sudo systemctl enable sshd
  3. Configure SSH server

    sudo vim /etc/ssh/sshd_config
    # Disable password authentication
    PasswordAuthentication no
    
    # Disable root login
    PermitRootLogin no
    
    # Only allow specific users
    AllowUsers <username>

Client Setup

  1. Generate SSH key

    ssh-keygen -t ed25519 -C "[email protected]"
  2. Copy SSH key to server

    ssh-copy-id -i ~/.ssh/id_ed25519.pub <username>@<server_ip>
  3. Configure SSH client

    vim ~/.ssh/config
    Host <alias>
        HostName <server_ip>
        User <username>
        IdentityFile ~/.ssh/id_ed25519