]> gitweb.fluxo.info Git - utils-ssh.git/commitdiff
Adds ssh-privsend
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 13 Mar 2017 22:48:03 +0000 (19:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 13 Mar 2017 22:48:03 +0000 (19:48 -0300)
ssh-privsend [new file with mode: 0755]

diff --git a/ssh-privsend b/ssh-privsend
new file mode 100755 (executable)
index 0000000..a7788a2
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Send both public and private keys to a server.
+#
+
+KEY="$1"
+SERVER="$2"
+DESTKEY="~/.ssh/`basename $KEY`"
+
+# Put on authorized_keys
+#cat $KEY | ssh $SERVER "mkdir -p ~/.ssh && chmod 700 ~/.ssh && touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && cat >> ~/.ssh/authorized_keys"
+
+# Public key
+cat $KEY.pub | ssh $SERVER "mkdir -p ~/.ssh && chmod 700 ~/.ssh && touch $DESTKEY.pub && chmod 600 $DESTKEY.pub && cat >> $DESTKEY.pub"
+
+# Private key
+cat $KEY     | ssh $SERVER "mkdir -p ~/.ssh && chmod 700 ~/.ssh && touch $DESTKEY     && chmod 600 $DESTKEY     && cat >> $DESTKEY"