Home

OpenSUSE sshd Setup For pubkey

WARNING: This can lock you out if anything goes wrong

Key generation [local]

  1. Use ssh-keygen to create key pair

    ssh-keygen -t ed25519 -C "name@example.com"
    
  2. Using xclip to copy public key from local machine

    xclip -selection clipboard < ~/.ssh/id_ed25519.pub
    

Add key to authorized_keys [remote]

  1. Create file authorized_keys at root home dir /root

    touch authorized_keys
    
  2. Change permissions to 644

    chmod 644 authorized_keys
    
  3. Add ssh pubkey to authorized_keys using nano or vim

Configure sshd [remote]

  1. File sshd_config is located in /etc/ssh

  2. Set following options

    PubkeyAuthentication yes 
    AuthorizedKeysFile .ssh/authorized_keys
    PasswordAuthentication no
    ChallengeResponseAuthentication no
    UsePAM yes
    
  3. Restard sshd

    systemctl restart sshd