From: Wayne Davison Date: Sat, 9 Apr 2011 15:33:55 +0000 (-0700) Subject: Improve lsh's handling of -l user option w/cd. X-Git-Tag: v3.1.0pre1~128 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=591c224584c04e0d6f58ece969946bd5472f7c89;p=thirdparty%2Frsync.git Improve lsh's handling of -l user option w/cd. --- diff --git a/support/lsh b/support/lsh index 65488dc7..8ccc5a26 100755 --- a/support/lsh +++ b/support/lsh @@ -7,7 +7,6 @@ # command. user='' -prefix='' do_cd=y # Default path is user's home dir, just like ssh. while : ; do @@ -22,14 +21,13 @@ while : ; do done if [ "$user" ]; then - prefix="sudo -H -u '$user'" + prefix='' if [ $do_cd = y ]; then home=`perl -e "print((getpwnam('$user'))[7])"` - # Yeah, this may fail, but attempts to get sudo to cd are harder. - cd $home + prefix="cd '$home' ;" fi -elif [ $do_cd = y ]; then - cd + sudo -H -u "$user" sh -c "$prefix $*" +else + [ $do_cd = y ] && cd + eval "${@}" fi - -eval $prefix "${@}"