Permissions, Permissions, Permissions

Bobby Sanders ssanders at ssvzc.com
Sun Jul 2 23:36:06 UTC 2006


On Mon, 2006-07-03 at 06:32 +1000, James Gray wrote:

> On 3/7/06 4:55 AM, "Bobby Sanders" <ssanders at ssvzc.com> wrote:
> 
> > Running Breezy. gnome2, metacity
> > 
> > For user joe, set Joe's umask to 0007 in ~/joe/.bashrc
> 
> Maybe have a read on how to set a umask properly.  A four digit umask makes
> no sense - what's the 4th digit supposed to set?  You can only mask the
> owner/group/other permissions, not the sticky/UID/etc bits.

If I understand umask, it bitwise ORs the mask with 7777 to get the
octal permissions you want.

man chmod says:

"A  numeric  mode  is  from  one  to four octal digits (0-7), derived by
adding up the bits with values 4, 2, and 1.   Any  omitted  digits  are
assumed  to  be leading zeros.  The first digit selects the set user ID
(4) and set group ID (2) and sticky (1) attributes.  The  second  digit
selects  permissions  for  the  user who owns the file: read (4), write
(2), and execute (1); the third selects permissions for other users  in
the file’s group, with the same values; and the fourth for other users
not in the file’s group, with the same values."

Thus, using 4 digits in the umask is perfectly acceptable.  Further,
using this mode for setting permissions works fine here.

> However, the screwy umsk isn't your problem.  Your problem is in the
> different ways the umask is sourced for terminal and X11 apps.  The proper
> place to set "universal" login prefs is in  /etc/login.def (IIRC - I'm on my
> Mac ATM).  Reading that file though, you'll quickly discover there is a
> better way with pam_umask (IIRC).

I think you are probably right here.  I seem to recall reading somewhere
(probably in /etc/login.def) that pam umask is the preferred way to set
file and directory creation masks.  However, Wander's suggestion (see
following message) works well for me and I don't have the time just now
to explore the wonders of Pam - I hope to do that someday, but not now.

Thanks so much for your input.  It was very helpful

Bobby




More information about the ubuntu-users mailing list