aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-13 19:48:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-13 19:48:03 -0300
commit7a971e64a274598c473e0b70d3e709c63a4b6d9c (patch)
tree05d63130f8c5105963cecbd34167b87c877dfe30
parentb9bb5c09fa71d5cfc4cb9bb534bf14cec2d906ec (diff)
downloadutils-ssh-7a971e64a274598c473e0b70d3e709c63a4b6d9c.tar.gz
utils-ssh-7a971e64a274598c473e0b70d3e709c63a4b6d9c.tar.bz2
Adds ssh-privsend
-rwxr-xr-xssh-privsend17
1 files changed, 17 insertions, 0 deletions
diff --git a/ssh-privsend b/ssh-privsend
new file mode 100755
index 0000000..a7788a2
--- /dev/null
+++ b/ssh-privsend
@@ -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"