diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-03-14 10:43:44 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-03-14 10:43:44 -0300 |
commit | 865f31757cee0de1d38f7831509dc745c9021492 (patch) | |
tree | 9cafe420b93b5c8ac5b6607a9a4663f6c35e8077 /ssh-authorized-send | |
parent | 123a756c8ea7cd103f28d8bf0751966a6ad19892 (diff) | |
download | utils-ssh-865f31757cee0de1d38f7831509dc745c9021492.tar.gz utils-ssh-865f31757cee0de1d38f7831509dc745c9021492.tar.bz2 |
Support for multiple servers on ssh-privsend and ssh-authorized-send
Diffstat (limited to 'ssh-authorized-send')
-rwxr-xr-x | ssh-authorized-send | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ssh-authorized-send b/ssh-authorized-send index ac687ff..22f5596 100755 --- a/ssh-authorized-send +++ b/ssh-authorized-send @@ -6,12 +6,11 @@ # Parameters BASENAME="`basename $0`" KEY="$1" -SERVER="$2" -DESTKEY="~/.ssh/`basename $KEY`" +SERVERS="$*" # Checks -if [ -z "$KEY" ]; then - echo "usage: $BASENAME <public-key-file>" +if [ -z "$SERVERS" ]; then + echo "usage: $BASENAME <public-key-file> <server1> [server2 .. serverN]" exit 1 elif [ ! -e "$KEY" ]; then echo "$BASENAME: file not found: $KEY" @@ -21,5 +20,11 @@ elif grep -q -i private $KEY; then exit 1 fi +# Destination key +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" +for SERVER in $SERVERS; do + echo "Uploading key into $SERVER..." + cat $KEY | ssh $SERVER "mkdir -p ~/.ssh && chmod 700 ~/.ssh && touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && cat >> ~/.ssh/authorized_keys" +done |