1 |
On 16/09/2015 00:36, Fernando Rodriguez wrote: |
2 |
> On Tuesday, September 15, 2015 10:25:15 PM Alan McKinnon wrote: |
3 |
>> On 15/09/2015 22:09, james wrote: |
4 |
>>> Hello, |
5 |
>>> |
6 |
>>> So looking at /etc/portage/repos.conf, it seems root.root owns these |
7 |
>>> files; shouldn't it be portage.portage? and /usr/portage |
8 |
>>> |
9 |
>>> That got me thinking. Everywhere that portage operates or owns |
10 |
>>> things, should the ownership not be portage.portage |
11 |
>>> and what would the typical permissions be? |
12 |
>> |
13 |
>> Here, all of /etc/portage is root:root |
14 |
>> The tree and all overlays are portage:portage |
15 |
>> |
16 |
>> You can make a local overlay owned by user you want, stuff you hack away |
17 |
>> at yourself should probably be james:james or james:users |
18 |
>> |
19 |
>> Typically, permissions in /etc/portage are the usual 755 for dirs and |
20 |
>> 644 for files |
21 |
>> |
22 |
>> I set overlays and the tree to be 2775 for dirs and 664 for files |
23 |
>> |
24 |
>>> |
25 |
>>> Is there a master list I can look at? Surely root not own all |
26 |
>>> these dirs, like /usr/portage/* ? My /usr/portage is root.root |
27 |
>>> and 755 on permissions, is that right? |
28 |
>> |
29 |
>> Permissions should be what YOU need them to be on your computer. There's |
30 |
>> a default, it's what portage makes them when you install stuff |
31 |
>> |
32 |
>>> |
33 |
>>> If so, why? |
34 |
>> |
35 |
>> Only root should change the master config files in /etc, just like in |
36 |
>> all other apps |
37 |
>> IIRC emerge can drop privs to a user account, if that user is portage |
38 |
>> then portage must own the files |
39 |
> |
40 |
> It is true that portage drops privileges to the portage account (unless the |
41 |
> ebuild has RESTRICT="userpriv" or I think FEATURES="-userpriv" on make.conf) |
42 |
> but it doesn't need to write to the portage tree except to the distfiles |
43 |
> directory so I don't know of any reason to have everything owned by |
44 |
> portage:portage if the perms are 755/644. |
45 |
|
46 |
portage also syncs the tree. For that it needs write perms. |
47 |
|
48 |
> |
49 |
> Mine is owned by root:root because it got borked one time after a sync so I |
50 |
> deleted it and copied from another box manually. The only problem I ever had |
51 |
> is that a fetch failed, and I just chowned the distfiles dir to portage:portage |
52 |
> to fix it. Only recently it was pointed to me on this list that it was supposed |
53 |
> to be portage:portage. I never changed it back to portage:portage but I made a |
54 |
> mental note not to forget about it in case of trouble, that way I'll learn why |
55 |
> that's the default if/when something breaks :) Besides it offers some (limited) |
56 |
> protection against an ebuild accidentally writing to your portage tree. |
57 |
> |
58 |
>>> |
59 |
>>> In my /usr/local/portage and it's subdirs where I hack on many |
60 |
>>> ebuild, portage.portage owns everything.....? |
61 |
>> |
62 |
>> Make your life easy, chaown that stuff to james |
63 |
> |
64 |
> I personally prefer root:root because I think it is more secure. If you let |
65 |
> somebody use your account even for a minute s/he could modify an ebuild |
66 |
> without a password to install whatever s/he wants next time you run an update. |
67 |
|
68 |
I'll argue that it's less secure. Giving someone else a gap to modify |
69 |
your ebuilds when you accidentally leave the computer unlocked is a rare |
70 |
event whereas you modifying your own ebuilds like james does is a common |
71 |
event. |
72 |
|
73 |
If an overlay is root:root then he has to be root every time he works on |
74 |
it. If he then commits that rare blunder of leaving the computer |
75 |
unlocked, Murphy says he'll do it with a root shell open. |
76 |
|
77 |
While it is entirely possible to have a rogue colleague install a dodgy |
78 |
ebuild, that attacker would have to know exactly what to install where |
79 |
and would have to have the ebuild on hand to slip it in during the very |
80 |
few minutes available. To my eye that's a very small window of |
81 |
opportunity and needs a perfect storm to pull it off = vanishingly small |
82 |
risk |
83 |
|
84 |
-- |
85 |
Alan McKinnon |
86 |
alan.mckinnon@×××××.com |