changeset 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 14eee9200854
children af7b427b3b83
files bin/add_ssh_key.sh
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
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