|
Lines 7-12
Link Here
|
| 7 |
|
7 |
|
| 8 |
ID_FILE="${HOME}/.ssh/id_rsa.pub" |
8 |
ID_FILE="${HOME}/.ssh/id_rsa.pub" |
| 9 |
|
9 |
|
|
|
10 |
if [ "-p" = "$1" ]; then |
| 11 |
shift |
| 12 |
PORT_OPT="-p $1" |
| 13 |
shift |
| 14 |
fi |
| 15 |
|
| 10 |
if [ "-i" = "$1" ]; then |
16 |
if [ "-i" = "$1" ]; then |
| 11 |
shift |
17 |
shift |
| 12 |
# check if we have 2 parameters left, if so the first is the new ID file |
18 |
# check if we have 2 parameters left, if so the first is the new ID file |
|
Lines 34-44
Link Here
|
| 34 |
fi |
40 |
fi |
| 35 |
|
41 |
|
| 36 |
if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then |
42 |
if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then |
| 37 |
echo "Usage: $0 [-i [identity_file]] [user@]machine" >&2 |
43 |
echo "Usage: $0 [-p port] [-i [identity_file]] [user@]machine" >&2 |
| 38 |
exit 1 |
44 |
exit 1 |
| 39 |
fi |
45 |
fi |
| 40 |
|
46 |
|
| 41 |
{ eval "$GET_ID" ; } | ssh $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys; test -x /sbin/restorecon && /sbin/restorecon .ssh .ssh/authorized_keys" || exit 1 |
47 |
{ eval "$GET_ID" ; } | ssh $PORT_OPT $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys; test -x /sbin/restorecon && /sbin/restorecon .ssh .ssh/authorized_keys" || exit 1 |
| 42 |
|
48 |
|
| 43 |
cat <<EOF |
49 |
cat <<EOF |
| 44 |
Now try logging into the machine, with "ssh '$1'", and check in: |
50 |
Now try logging into the machine, with "ssh '$1'", and check in: |