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:04:41
Message-Id: 42CBF0B1.1020308@planet.nl
In Reply to: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? by Edward Catmur
1 Edward Catmur schreef:
2 > On Wed, 2005-07-06 at 15:52 +0200, Holly Bostick wrote:
3 >
4 >>Echo is in the sudo-ed group, and echo isn't the problem-- the problem
5 >>is that permission is refused to write to the file itself (which is an
6 >>error *from* echo, so it would seem that echo itself is OK as far as
7 >>sudo goes). Which means that I have to su anyway, to echo to the file,
8 >>which really isn't the point of the exercise.
9 >>
10 >>As I see it, this error can mean only one of two things:
11 >>
12 >>sudo does not give me a login shell (so my UID is 'really' still my UID
13 >>and not root's, and I don't have permission to write to the file); or
14 >>
15 >>there is another, "invisible" cli utility responsible for actually
16 >>writing to the file, which is not sudo-ed.
17 >
18 >
19 > If you're using e.g. "sudo echo package >> /etc/portage/package.unmask"
20 > then the redirection takes place in your shell, not in sudo.
21 >
22 > HTH.
23 >
24
25 OK, you all likely realize that I responded before I had got the three
26 more messages telling me what to do.
27
28 I'm sure it will work (three people telling you the exact same thing is
29 pretty convincing ;-) ), but what I don't understand is why/how, if I
30 want to
31
32 sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords
33
34 changing that to
35
36 "sudo echo media-video/xine-ui ~x86 >>/etc/portage/package.keywords"
37
38 is going to write the line
39
40 media-video/xine-ui ~x86
41
42 to /etc/portage/package.keywords-- i.e., why are the internal quotes no
43 longer necessary?
44
45 Or should it be
46
47 "sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords"
48
49 or will that *really* screw everything up?
50
51 (As you see, my understanding of bash is trying to improve, with only
52 very limited success :-) ).
53
54 Holly
55 --
56 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] sudo echo cannot write to /etc/ files ? David Morgan <david.morgan@××××××××××××××××.uk>