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

Re: Forcing user's umask in GNOME



Le ven 03/09/2004 à 02:38, Jérôme Warnier a écrit :
> Le ven 03/09/2004 à 02:09, Jérôme Warnier a écrit :
> > Well, I thought that it would only be needed to change UMASK in
> > /etc/login.defs but it does not work on Sarge/Sid.
> > The parsing of the file is weak, and will fail if a commented line with
> > UMASK in it is present before the right one, uncommented.
> Related to bug #254840.
> 
> > Anybody knows where to look before I spend a whole week on it?

I've spend some time on it already. Here is what I've done now to try to
debug the stuff:
I created a file /etc/X11/Xsession.d/55umask which contains exactly
this.
---cut here---
# In the script that called this, set -e has been set. Errors in any
# command will abort the entire script and X won't start. By putting
# this part in a subshell, any errors will abort the subshell - which
# we want, in case numlockx fails.

# The 'true' at the end ensures that the entire script will never end
# with an error code, even if there was an error.

# Ariel Shkedi <asdebian@dsgml.com>

# Most of this script has been borrowed from old /etc/gdm/Sessions/Gnome
# by me, Jerome Warnier <jwarnier@beeznest.net>
# Will be extended later to copy completely the old Session script

logindefsfile=/etc/login.defs

(

haveloginoption() {
  optionname=$1
  echo "$0: checking $logindefsfile for option $optionname" >&2
  grep -qs ^$optionname $logindefsfile
}

loginoptionvalue() {
  optionname=$1
  optionvalue=`awk "\\$1 == \"$optionname\" { print \\$2 }"
$logindefsfile`
  echo "$0: $logindefsfile: \"$1\" is \"$optionvalue\"" >&2
  echo $optionvalue
}

# Get defaults from /etc/login.defs
if haveloginoption UMASK; then
  umask `loginoptionvalue UMASK`
  echo `umask` # This line is for debugging purpose only
fi

)

true
---cut here---

Here is what I get in my .xsession-errors.
---cut here---
/etc/gdm/PreSession/Default: Registering your session with wtmp and utmp
/etc/gdm/PreSession/Default: running: /usr/bin/X11/sessreg -a -w
/var/log/wtmp -u /var/run/utmp -x "/var/lib/gdm/:0.Xservers" -h "" -l
":0" "jwarnier"
/etc/gdm/Xsession: Beginning session setup...
/etc/gdm/Xsession: checking /etc/login.defs for option UMASK
/etc/gdm/Xsession: /etc/login.defs: "UMASK" is "002"
0002
SESSION_MANAGER=local/aphrodite:/tmp/.ICE-unix/21512
---cut here---

Files in Nautilus are still created with umask 022, and a shell in
gnome-terminal tells me umask is set to 022 also. I honestly don't
understand what's going on there...

Hope all this helps to debug.

> > Thanks
-- 
Jérôme Warnier
Consultant
BeezNest
http://beeznest.net



Reply to: