summaryrefslogtreecommitdiff
path: root/contrib/ssh-copy-id
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ssh-copy-id')
-rw-r--r--contrib/ssh-copy-id10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
index acd36d398..2f757de4b 100644
--- a/contrib/ssh-copy-id
+++ b/contrib/ssh-copy-id
@@ -1,11 +1,11 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Shell script to install your identity.pub on a remote machine 3# Shell script to install your public key on a remote machine
4# Takes the remote machine name as an argument. 4# Takes the remote machine name as an argument.
5# Obviously, the remote machine must accept password authentication, 5# Obviously, the remote machine must accept password authentication,
6# or one of the other keys in your ssh-agent, for this to work. 6# or one of the other keys in your ssh-agent, for this to work.
7 7
8ID_FILE="${HOME}/.ssh/identity.pub" 8ID_FILE="${HOME}/.ssh/id_rsa.pub"
9 9
10if [ "-i" = "$1" ]; then 10if [ "-i" = "$1" ]; then
11 shift 11 shift
@@ -19,7 +19,7 @@ if [ "-i" = "$1" ]; then
19 shift # and this should leave $1 as the target name 19 shift # and this should leave $1 as the target name
20 fi 20 fi
21else 21else
22 if [ x$SSH_AUTH_SOCK != x ] ; then 22 if [ x$SSH_AUTH_SOCK != x ] && ssh-add -L >/dev/null 2>&1; then
23 GET_ID="$GET_ID ssh-add -L" 23 GET_ID="$GET_ID ssh-add -L"
24 fi 24 fi
25fi 25fi
@@ -38,10 +38,10 @@ if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
38 exit 1 38 exit 1
39fi 39fi
40 40
41{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1 41{ eval "$GET_ID" ; } | ssh ${1%:} "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1
42 42
43cat <<EOF 43cat <<EOF
44Now try logging into the machine, with "ssh '$1'", and check in: 44Now try logging into the machine, with "ssh '${1%:}'", and check in:
45 45
46 .ssh/authorized_keys 46 .ssh/authorized_keys
47 47