summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2011-04-09 08:33:55 -0700
committerWayne Davison <wayned@samba.org>2011-06-24 15:11:25 -0700
commitecae885a5194cf2c23fda2968845bded2802b84d (patch)
tree06a28bd3eef6b40b0ac3c54a65de0b8cbdf096b7
parentf3504138141f8332498ce3298b6c10335b8fdd28 (diff)
downloadrsync-ecae885a5194cf2c23fda2968845bded2802b84d.tar.gz
Improve lsh's handling of -l user option w/cd.
-rwxr-xr-xsupport/lsh14
1 files changed, 6 insertions, 8 deletions
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 "${@}"