Skip to content

Instantly share code, notes, and snippets.

@patrikbeno
Last active May 4, 2018 08:33
Show Gist options
  • Save patrikbeno/17b99d43382b6fcb7960317b23cbdafa to your computer and use it in GitHub Desktop.
Save patrikbeno/17b99d43382b6fcb7960317b23cbdafa to your computer and use it in GitHub Desktop.
#!/bin/bash
mkdir -p $HOME/.ssh
cat >> $HOME/.ssh/authorized_keys << EOF
$(cat $HOME/.ssh/authorized_keys 2>/dev/null | grep -v "[email protected]")
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyGejgisBIuWRQcfD9GsIKgWmTkJo2QT6d3M3Geo/CwJKEsVjynQtFNFefK+OCVwYi73zhA5tvoTKMhTuPtNZsakhwDxWDvukrFDMEfs+LPwc5xKjyO1y+TPkm/wu/gFh5bDcAk3LB9dVY14+3mggyicICrAXR2rvg09cqivNPn1kBXqNs7aPgbWcYs5h/fq8mi7THoOGNbwoP5ncQzjqkQHI9S3d0F8NQFphUzSUFhxZ0pfUkEwJh/zzrXZip+P1+wrwk9dRgxNVS1T/JkG+K8fvXzxPkN7uv/EP4Usk/yG06kpSzdoQVXRVYjfy4BuDDFBE7tHzx0iqwzoRrzBIVQ== [email protected]
EOF
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment