Gentoo Archives: gentoo-user

From: Hinko Kocevar <hinko.kocevar@××××××.si>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] default user permissions
Date: Fri, 26 Mar 2010 07:20:26
Message-Id: 4BAC5FF7.3050806@i-tech.si
In Reply to: Re: [gentoo-user] default user permissions by Florian Philipp
1 Hi,
2
3 Thanks for the help.
4
5 Best regards,
6 Hinko
7
8 On 03/25/10 22:43, Florian Philipp wrote:
9 > Am 25.03.2010 09:50, schrieb Alan McKinnon:
10 >> On Thursday 25 March 2010 10:26:25 Hinko Kocevar wrote:
11 >>> Hi,
12 >>>
13 >>> Where is defined what permissions will the newly created folder/file
14 >>> have by default?
15 >>
16 >> This is done by the umask of the user creating the folder.
17 >>
18 >>
19 >>>
20 >>> Eg. When creating a folder I would like it to have permissions right
21 >>> after it is created, to void use of chmod/chown afterwards:
22 >>>
23 >>> drwxrwxr-x 2 hinko users 4096 Mar 25 09:23 folder1
24 >>>
25 >>> while now I get only:
26 >>> drwxr-xr-x 2 hinko users 4096 Mar 25 09:23 folder1
27 >>>
28 >>> That is group should have 'w' set.
29 >>
30 >>
31 >> This is a common misunderstanding about permissions and the Unix philosophy
32 >> about them, which is:
33 >>
34 >> It's up to the user, not the system, to say what permissions he wants on new
35 >> filesystem objects.
36 >>
37 >> Modifing the user's umask is not advised, as this is global. *Every* new file
38 >> or dir then ends up with g+w and you probably don't want that.
39 >>
40 >> You need to use Posix ACLs for this, and your file system and kernel must
41 >> support them; you configure it per directory. It's all in man pages and on
42 >> google - better start reading.
43 >>
44 >> Be warned though: you *will* forget you set this, and *will* wonder in future
45 >> why g+w is set in various places. "ls" gives precious little clue that an ACL
46 >> is in place.
47 >>
48 >> I find that in real life, a "find -exec chmod" in a cron is a better solution
49 >>
50 >
51 > To avoid ACLs and still have group rw rights on some folders for
52 > specific groups, you can make use of the 'user private group' scheme and
53 > the setgid bit: [1].
54 >
55 > Gentoo uses this scheme per default, although I think the umask setting
56 > is different (has to be 002 or 007).
57 >
58 > What Alan forgot to tell is where to set the umask: /etc/profile. Don't
59 > use too strict settings because these are also applied to system
60 > accounts. This can easily break your system.
61 >
62 > [1]
63 > http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/ref-guide/s1-users-groups-private-groups.html
64 >
65 > Hope this helps,
66 > Florian Philipp
67 >
68
69
70 --
71 Hinko Kocevar
72 Technical support software engineer
73 Instrumentation Technologies
74 Velika pot 22, SI-5250 Solkan - Slovenia
75 T:+386 5 3352600, F:+386 5 3352601
76 mailto: hinko.kocevar@××××××.si
77
78 http://www.i-tech.si - When your users demand stability
79
80 The information transmitted is intended solely for the addressee and may
81 contain confidential and/or privileged information. Any review, retention,
82 disclosure or other use by persons other than the intended recipient is
83 prohibited. If you received this in error, please notify the sender and
84 delete all copies.