Gentoo Archives: gentoo-user

From: Holly Bostick <motub@××××××.nl>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] sudo echo cannot write to /etc/ files ?
Date: Wed, 06 Jul 2005 15:29:02
Message-Id: 42CBF70B.4010703@planet.nl
In Reply to: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? by gentoo@depardo.ch
1 gentoo@×××××××.ch schreef:
2 > Le Mercredi, 6 Juillet 2005 15.52, Holly Bostick a ecrit :
3 >
4 >>Hey, ho--
5 >>
6 >>I've finally got around to setting up sudo. It works fine, except for
7 >>one thing.
8 >>
9 >>I made a Cmd_Alias group which includes a lot of utility apps. And, like
10 >>many of you, I included emerge in this group.
11 >>
12 >>But a lot of the time, I have to echo to one of the files in
13 >>/etc/portage.
14 >>
15 >>Echo is in the sudo-ed group, and echo isn't the problem-- the problem
16 >>is that permission is refused to write to the file itself
17 >>
18 >>As I see it, this error can mean only one of two things:
19 >>
20 >>sudo does not give me a login shell (so my UID is 'really' still my UID
21 >>and not root's, and I don't have permission to write to the file); or
22 >>
23 >>there is another, "invisible" cli utility responsible for actually
24 >>writing to the file, which is not sudo-ed.
25 >>
26 >>Or could it be something else?
27 >>
28 >>In any case, does anybody know how I could fix this? It's really
29 >>screwing up my useability, which was just starting to shape up nicely :-) .
30 >>
31 >>Thanks,
32 >>Holly
33 >
34 >
35 > I think the problem come from the fact that echo is sudo-ed but the shell
36 > redirection isn't.
37 >
38 > Compare this:
39 > su -c "echo foo > /etc/portage/whatever"
40 > and
41 > su -c "echo foo" > /etc/portage/whatever
42 >
43 > The first one will succeed, but not the second.
44 >
45 > To solve your problem, I would just do:
46 > chgrp -R portage /etc/portage
47 > chmod -R g+w /etc/portage
48 >
49
50 Well, it didn't work (this to all the respondents).
51
52 I did change the group and mod of /etc/portage, but even before I did:
53
54 "sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords"
55 -bash: sudo echo 'media-video/xine-ui ~x86'
56 >>/etc/portage/package.keywords: Onbekend bestand of map
57
58 ("unknown file or folder", which is at least different, but not really
59 much of an improvement, and no, before someone asks, putting a space
60 before /etc doesn't help)
61
62 and even after chowning and chmodding:
63
64 sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords
65 -bash: /etc/portage/package.keywords: Toegang geweigerd
66
67 (permission refused)
68
69 with the quotes, it's unknown file or folder.
70
71 la /etc/portage
72 totaal 51
73 drwxrwxr-x 5 root portage 384 jun 13 00:40 .
74 drwxr-xr-x 88 root root 7312 jul 6 16:15 ..
75 -rw-rw-r-- 1 root portage 9757 jul 6 17:09 package.keywords
76 -rw-rw-r-- 1 root portage 6164 mei 26 11:47 package.keywords~
77 -rw-rw-r-- 1 root portage 64 jun 15 05:27 package.mask
78 -rw-rw-r-- 1 root portage 100 mei 16 14:57 package.mask~
79 -rw-rw-r-- 1 root portage 105 jun 15 05:27 package.unmask
80 -rw-rw-r-- 1 root portage 103 mei 15 21:09 package.unmask~
81 -rw-rw-r-- 1 root portage 2252 jun 30 12:32 package.use
82 -rw-rw-r-- 1 root portage 1616 mei 12 15:46 package.use~
83 drwxrwxr-x 2 root portage 80 nov 26 2004 profile
84 drwxrwxr-x 2 root portage 72 jun 2 13:10 profiles
85 drwxrwsr-x 2 root portage 48 okt 27 2004 sets
86
87
88 Not really sure what good the portage group was supposed to do anyway,
89 since root is a member of that group, but then again root owns the whole
90 shebang anyway. The user is not a member of the portage group.
91
92 Should I chown the folder -R to users? (seems again quite not the
93 point)? It still seems that what I really want is a login shell that I'm
94 not getting.
95
96 I'm really lost. Where am I going wrong?
97
98 Oh, btw, just remembered-- this is bash 3. Does that make a difference?
99
100 Holly
101
102
103 --
104 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] sudo echo cannot write to /etc/ files ? Christoph Gysin <cgysin@×××.ch>
Re: [gentoo-user] sudo echo cannot write to /etc/ files ? gentoo@×××××××.ch
Re: [gentoo-user] sudo echo cannot write to /etc/ files ? "Boyd Stephen Smith Jr." <bss03@××××××××××.com>