[sysadmin-bin: 70/168] Change to / before sudo'ing to gitadmin



commit f22a5124f87a385223b7dca79fea73b12d0f8f86
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Mar 25 10:53:30 2009 -0400

    Change to / before sudo'ing to gitadmin
    
    This prevents problems when the cwd is the user's home directory
    and that isn't world readable/executable.

 create-repository |    2 +-
 update-cgit       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/create-repository b/create-repository
index d453973..99c231f 100755
--- a/create-repository
+++ b/create-repository
@@ -13,7 +13,7 @@ umask 0002
 BINDIR=/home/admin/gitadmin-bin
 
 if [ `whoami` != gitadmin ] ; then
-    exec sudo -u gitadmin $BINDIR/create-repository "$@"
+    cd / && exec sudo -u gitadmin $BINDIR/create-repository "$@"
 fi
 
 . $BINDIR/functions
diff --git a/update-cgit b/update-cgit
index 6f51d94..841b7fe 100755
--- a/update-cgit
+++ b/update-cgit
@@ -9,7 +9,7 @@
 BINDIR=/home/admin/gitadmin-bin
 
 if [ `whoami` != gitadmin ] ; then
-    exec sudo -u gitadmin $BINDIR/update-cgit "$@"
+    cd / && exec sudo -u gitadmin $BINDIR/update-cgit "$@"
 fi
 
 echo -n "Updating the cgit repository list... "



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]