Skip to content

Instantly share code, notes, and snippets.

@syousif94
Created May 1, 2020 23:10
Show Gist options
  • Save syousif94/95952f59db383353c7dcd220cce2f8db to your computer and use it in GitHub Desktop.
Save syousif94/95952f59db383353c7dcd220cce2f8db to your computer and use it in GitHub Desktop.
copy ssh key to server
#!/bin/bash
cat ~/.ssh/id_rsa.pub | ssh remote_username@server_ip_address "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment