diff bin/add_ssh_key.sh @ 756:12f0be02e9cc

http://www.howtogeek.com/168147/add-public-ssh-key-to-remote-server-in-a-single-command/
author Jeff Hammel <k0scist@gmail.com>
date Wed, 05 Aug 2015 08:44:23 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/add_ssh_key.sh	Wed Aug 05 08:44:23 2015 -0700
@@ -0,0 +1,10 @@
+#!/bin/bash -x
+
+# see http://www.howtogeek.com/168147/add-public-ssh-key-to-remote-server-in-a-single-command/
+
+KEY=~/.ssh/id_rsa.pub
+
+for arg in $@
+do
+    cat "${KEY}" | ssh ${arg} 'cat >> .ssh/authorized_keys'
+done