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 14:38:33
Message-Id: 42CBE9D1.5050203@planet.nl
In Reply to: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? by "A. Khattri"
1 A. Khattri schreef:
2 > On Wed, 6 Jul 2005, Holly Bostick wrote:
3 >
4 >
5 >>Echo is in the sudo-ed group, and echo isn't the problem-- the problem
6 >>is that permission is refused to write to the file itself (which is an
7 >>error *from* echo, so it would seem that echo itself is OK as far as
8 >>sudo goes). Which means that I have to su anyway, to echo to the file,
9 >>which really isn't the point of the exercise.
10 >
11 >
12 > What is in /etc/sudoers?
13 >
14 > Either the problem is there or maybe its because in some shells, echo is a
15 > built-in command and in others its not (so /bin/echo comes into play).
16 >
17 >
18
19 Well, I'm not going to copy my entire file, but I've got /usr/bin/echo
20 sudoed (because that's what 'which echo' said was the path to echo).
21
22 But doing a locate echo reveals that there is also a /bin/echo.... oh,
23 and la /usr/bin/echo reveals it to be a symlink to /bin/echo. Fine. What
24 in the bloody blue blazes does that tell me? Changing visudo to allow
25 /bin/echo rather than /usr/bin/echo didn't do a thing.
26
27 I'm using bash, like a boring person. Looking (searching, actually)
28 through man bash, I can see that echo is a built-in-- do I have to sudo
29 bash as well? And in any case, echo isn't refusing to run-- if I run
30
31 secho $JAVA_HOME, I get a return... but it's the return of the *user's*
32 JAVA_HOME, rather than the *system* JAVA_HOME.
33
34 This supports my theory that this is a regular su shell and not an su -
35 shell, which is not much help to me in this situation (for echo to write
36 to the /etc/files, I need UID 0).
37
38 So I suppose I could find this in man sudoers, but that's almost as bad
39 as man bash for trying to find something when you're not quite sure what
40 you're looking for.
41
42 Is there a way to get sudo to behave as a login shell when sudo-ing
43 rather than just a regular su? And is that a scalable or global change
44 (limitable would be nice)?
45
46 Holly
47 --
48 gentoo-user@g.o mailing list