diff --git a/security/safesh/Makefile b/security/safesh/Makefile index 32da5514e825..bc110262ef64 100644 --- a/security/safesh/Makefile +++ b/security/safesh/Makefile @@ -8,7 +8,7 @@ # PORTNAME= safesh -PORTVERSION= 1.4 +PORTVERSION= 1.5 CATEGORIES= security MASTER_SITES= # none DISTFILES= # none diff --git a/security/safesh/src/cvs-safesh.sh b/security/safesh/src/cvs-safesh.sh index 16ccfa71032a..e56e8116d7d1 100644 --- a/security/safesh/src/cvs-safesh.sh +++ b/security/safesh/src/cvs-safesh.sh @@ -1,2 +1,6 @@ #!/bin/sh -exec safesh $1 -- "$@" +if [ "$2" = "-l" ]; then + exec safesh $3@$1 -- "$@" +else + exec safesh $1 -- "$@" +fi diff --git a/security/safesh/src/safesh.sh b/security/safesh/src/safesh.sh index 194ed20a4ddd..3ea1c18d85e6 100644 --- a/security/safesh/src/safesh.sh +++ b/security/safesh/src/safesh.sh @@ -39,7 +39,7 @@ shift 2> /dev/null; HOSTDIR=$AKEYS/$USER@${HOST}-22 if [ ! -d $HOSTDIR ]; then while ! [ "$answer" = "yes" -o "$answer" = "no" ]; do - echo -n "New host $HOST - create key (yes/no)? " 1>&2 + echo -n "New user/host pair $USER@$HOST - create key (yes/no)? " 1>&2 read answer done if [ "$answer" = "no" ]; then @@ -115,7 +115,22 @@ fi BASENAME=`basename $0` if [ "$BASENAME" = "scpsh" ]; then - exec $SHELL -i + # Print information if we are running entirely interactive (or + # somebody is attempting to make us believe we are) + if [ -t 0 -a -t 1 -a -t 2 ]; then + echo ">>>" 1>&2 + echo ">>> Starting up shell with authentication variables." 1>&2 + echo ">>> You can now scp to $USER@$HOST without passwords." 1>&2 + if [ "$TGT" = "" ]; then + echo ">>> $USER@$HOST is available through the shorthand \$TGT" 1>&2 + fi + echo ">>>" 1>&2 + fi + if [ "$TGT" = "" ]; then + TGT=$USER@$HOST + export TGT + fi + exec $SHELL elif [ "$BASENAME" = "safeshinstall" ]; then cat $HOSTDIR/id_dsa.pub | ssh $USER@$HOST 'mkdir -p .ssh && cat >> .ssh/authorized_keys2' elif [ "$1" = "" ]; then