On Wed, Feb 01, 2006 at 07:19:33PM -0800, James G. Sack (jim) wrote: >George Georgalis wrote: >>I've written a script in sh (which is bash) which is executable >>and in the $USER $PATH >> >>when I was testing it, I used "sh doit.sh" and all was okay. >> >>Problem is that script needs to generate files with the same umask >>of $USER which is different from the system umask, and can change >>from user to user. >> >>Situation, when that is run as tested (login shell), all is fine. >>a umask of 007 is applied to files created. But when it's deposited >>in the $PATH directory and run as "doit.sh" it uses the system umask.
Hey Jim! how the heck are you? >The script is launched how? >..as root, I gather. nah, it's just a utility to change dos <-> unix text files and accepts $1, so doit.sh file.txt replaces that file >Does the script need to be run as $USER (let's say 'geo') yep. >If both above are so, and if this works as root > su - geo -c doit.sh >then, you can maybe to create a wrapper containing that line? > >Or equivalently just put this into doit.sh > [ 0 -eq $UID ] && exec su - geo -c $0 || disregard the user's umask and use the system's $0 $@ maybe just make it suid root :) // George -- George Georgalis, systems architect, administrator <IXOYE>< http://galis.org/ cell:646-331-2027 mailto:[EMAIL PROTECTED] -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
