ssh append authorized_keys on remote server

26. novembris, 2020

This is how to copy local ssh public key and append it to authorized_keys file on remote server

Bash
cat ~/.ssh/id_rsa.pub | ssh user@server "cat >> ~/.ssh/authorized_keys"

This commands consists of three (3) parts

  1. First copy content of ids_rsa.pub file
  2. Then pipe it to ssh. Connect to remote server with yout credentials
  3. And execute append command on remote server