Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: portage directory ownerships?
Date: Wed, 16 Sep 2015 06:09:58
Message-Id: 55F90792.9090809@gmail.com
In Reply to: [gentoo-user] Re: portage directory ownerships? by james
1 On 16/09/2015 04:19, james wrote:
2 > Fernando Rodriguez <frodriguez.developer <at> outlook.com> writes:
3 >
4 >
5 >>> Here, all of /etc/portage is root:root
6 >
7 > This is what I have except for distfiles::
8 > drwxrwxr-x 5 root portage 232K Sep 14 23:00 distfiles
9 >
10 > root.portage ??? I guess portage does that. Fernando's explaination
11 > seem plausible, I guess I'd have to look at the code (not today)
12 > but this just seems strange to me that sys-apps/portage would do this...
13
14 It's a valid technique. Root owns stuff and members of the portage group
15 can write distfiles. You can get the same effect with root:root and
16 making yourself a member of the root group, but that's over-reaching and
17 unwise
18
19 >
20 >>> The tree and all overlays are portage:portage
21 >
22 > Mine are root.root but no harm, right? I guess I could change them
23 > recursively to portage:portage but why, if portage is just going
24 > to do what it wants anyway.
25
26 No harm as long as all writes are done by root. You might not want that.
27 Forcing all writes to be done by root can open more security risks than
28 it closes, doubly so when the writes are something you intend to do often.
29
30
31 >
32 >
33 >
34 >>> You can make a local overlay owned by user you want, stuff you hack away
35 >>> at yourself should probably be james:james or james:users
36 >
37 > Yea, I gonna think about /usr/local/portage. I see the convenience of
38 > your suggestion, but I have always had most everthing portage:portage.
39 > I cannot remember why though.....
40
41 How long you been using gentoo? 5-10 years? That was the default install
42 settings for most of portage's lifetime.
43 >
44 >>>
45 >>> Typically, permissions in /etc/portage are the usual 755 for dirs and
46 >>> 644 for files
47 >>>
48 >>> I set overlays and the tree to be 2775 for dirs and 664 for files
49 >
50 > Yea, I have just let portage do what it wants and never really thought
51 > about it before. This seem reasonable.
52 >
53 >
54 >>> Permissions should be what YOU need them to be on your computer. There's
55 >>> a default, it's what portage makes them when you install stuff
56 >
57 > yep, it makes sense that sys-apps/portage is the master of these files,
58 > I just never thought about it much before.
59 >
60 >
61 >>> Only root should change the master config files in /etc, just like in
62 >>> all other apps IIRC emerge can drop privs to a user account, if that
63 >>> user is portage then portage must own the files
64 >
65 > Ah. makes sense.
66 >
67 >>
68 >> It is true that portage drops privileges to the portage account (unless the
69 >> ebuild has RESTRICT="userpriv" or I think FEATURES="-userpriv" on make.conf)
70 >
71 > Nope these are not set on my make.conf (600) on permissions).
72 >
73 >> but it doesn't need to write to the portage tree except to the distfiles
74 >> directory so I don't know of any reason to have everything owned by
75 >> portage:portage if the perms are 755/644.
76 >
77 > Ah, this is whay my distfiles is root:portage.....?
78 >
79 >>
80 >> Mine is owned by root:root because it got borked one time after a sync so I
81 >> deleted it and copied from another box manually. The only problem I ever had
82 >> is that a fetch failed, and I just chowned the distfiles dir to
83 > portage:portage
84 >> to fix it. Only recently it was pointed to me on this list that it was
85 > supposed
86 >> to be portage:portage. I never changed it back to portage:portage but I
87 > made a
88 >> mental note not to forget about it in case of trouble, that way I'll learn
89 > why
90 >> that's the default if/when something breaks :) Besides it offers some
91 > (limited)
92 >> protection against an ebuild accidentally writing to your portage tree.
93 >
94 > Interesting. I guess I could look at the code but everything is working
95 > fine.
96 >
97 >
98 >>>> In my /usr/local/portage and it's subdirs where I hack on many
99 >>>> ebuild, portage.portage owns everything.....?
100 >>>
101 >>> Make your life easy, chaown that stuff to james
102 >>
103 >> I personally prefer root:root because I think it is more secure. If you let
104 >> somebody use your account even for a minute s/he could modify an ebuild
105 >> without a password to install whatever s/he wants next time you run an update.
106 >
107 > I like Alan's simplicity. I also like root:root, like my /usr/portage,
108 > but most of it is portage:portage, and that I did do. I just cant
109 > remember why.
110 >
111 > usr/local/portage/ is the one I need to think about.
112
113 Here's what I suggest:
114
115 You're doing a lot of hacking on ebuilds. Make a local overlay in ~ and
116 have it owned by james:james, mode 644, just like all other code you'd
117 keep in ~.
118
119 Add that local repo to repos.conf/, leave the main portage dirs and
120 external overlays as they are and hack away on clustering stuff to your
121 heart's content
122
123
124 >
125 > Thanks for the feedback guys,
126 > James
127 >
128 >
129 >
130 >
131 >
132
133
134 --
135 Alan McKinnon
136 alan.mckinnon@×××××.com