Re: [gentoo-user] sudo echo

2006-03-25 Thread Alexander Skwar
Daniel da Veiga wrote: what I didn't notice was an alias for sudo as sudo su -c... Why are you doing that? What's the purpose of using su instead of sh here? Or put differently: Why use su to run sh when you could run sh directly? Could somebody please explain? Alexander Skwar -- Yeah, but

Re: [gentoo-user] sudo echo

2006-03-25 Thread Alexander Skwar
Neil Bothwick wrote: On Fri, 24 Mar 2006 00:58:09 +0100, Renat Golubchyk wrote: Alright, then run sudo bash -c 'echo some_string some_file' No problem here :) Except this means you have to give the user permission to run bash, and subsequently any command as root. True. But with sudo

Re: [gentoo-user] sudo echo

2006-03-25 Thread Neil Bothwick
On Sat, 25 Mar 2006 13:43:04 +0100, Alexander Skwar wrote: Except this means you have to give the user permission to run bash, and subsequently any command as root. True. But with sudo su -c, you've got to have the same sort of trust, don't you? Yes, they are both equally bad ideas.

Re: [gentoo-user] sudo echo

2006-03-24 Thread Neil Bothwick
On Fri, 24 Mar 2006 00:58:09 +0100, Renat Golubchyk wrote: Alright, then run sudo bash -c 'echo some_string some_file' No problem here :) Except this means you have to give the user permission to run bash, and subsequently any command as root. You may as well give them the root password

Re: [gentoo-user] sudo echo

2006-03-23 Thread Holly Bostick
JimD schreef: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords Well this one I do with a set of revised command nicked from the list, entered into ~/.bashrc, and

Re: [gentoo-user] sudo echo

2006-03-23 Thread Daniel da Veiga
On 3/23/06, JimD [EMAIL PROTECTED] wrote: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords if you do this, you'll execute sudo echo and try to redirect the output as

Re: [gentoo-user] sudo echo

2006-03-23 Thread Hans-Werner Hilse
Hi, On Thu, 23 Mar 2006 16:03:08 -0500 JimD [EMAIL PROTECTED] wrote: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords That's because your _current_ shell

Re: [gentoo-user] sudo echo

2006-03-23 Thread Alexander Skwar
JimD wrote: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords echo whatnot | sudo sh -c foo If you don't wish to append, the following can be used as well: echo

Re: [gentoo-user] sudo echo

2006-03-23 Thread Nick Rout
On Thu, 23 Mar 2006 16:03:08 -0500 JimD wrote: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords Another one I always wanted to know if it is possible is: sudo

Re: [gentoo-user] sudo echo

2006-03-23 Thread Alexander Skwar
Holly Bostick wrote: JimD schreef: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords Well this one I do with a set of revised command nicked from the list,

Re: [gentoo-user] sudo echo

2006-03-23 Thread Daniel da Veiga
On 3/23/06, Holly Bostick [EMAIL PROTECTED] wrote: JimD schreef: I have been using Linux for a number of years and the one trick I have never read how to do is something like: sudo echo app-portage/porthole ~* /etc/portage/package.keywords Well this one I do with a set of revised

Re: [gentoo-user] sudo echo

2006-03-23 Thread Renat Golubchyk
On Thu, 23 Mar 2006 18:27:46 -0300 Daniel da Veiga [EMAIL PROTECTED] wrote: Sudo takes a command as parameter, enclose the whole command in quotes and try again, like this: sudo echo app-portage/porthole ~* /etc/portage/package.keywords ^ ^ ^

Re: [gentoo-user] sudo echo

2006-03-23 Thread Neil Bothwick
On Fri, 24 Mar 2006 09:45:16 +1200, Nick Rout wrote: the elevation of privilege does not seem to survive the redirection. I suspect you need to know more than I do about the way redirection is handled by the shell to explain it. Redirection is applied before the command is executed, so you

Re: [gentoo-user] sudo echo

2006-03-23 Thread Bo Andresen
On Thursday 23 March 2006 23:38, Renat Golubchyk wrote: On Thu, 23 Mar 2006 18:27:46 -0300 Daniel da Veiga [EMAIL PROTECTED] wrote: Sudo takes a command as parameter, enclose the whole command in quotes and try again, like this: sudo echo app-portage/porthole ~*

Re: [gentoo-user] sudo echo

2006-03-23 Thread Boyd Stephen Smith Jr.
On Thursday 23 March 2006 16:33, JimD [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] sudo echo': If you type something like the following: /tmp/myfile.foo It will truncate the file. I use it when I want to clear out logs real quick. I can sudo su and then just type (without the quotes

Re: [gentoo-user] sudo echo

2006-03-23 Thread David Morgan
On 23:38 Thu 23 Mar , Renat Golubchyk wrote: Careful with those quotation marks - you might want to escape them ;-) I would use single quotes on the outside to avoid the confusion: sudo 'echo app-portage/porthole ~* /etc/portage/package.keywords' Do that and it'll say sudo: echo

Re: [gentoo-user] sudo echo

2006-03-23 Thread Renat Golubchyk
On Thu, 23 Mar 2006 23:12:38 + David Morgan [EMAIL PROTECTED] wrote: On 23:38 Thu 23 Mar , Renat Golubchyk wrote: Careful with those quotation marks - you might want to escape them ;-) I would use single quotes on the outside to avoid the confusion: sudo 'echo

Re: [gentoo-user] sudo echo

2006-03-23 Thread Bo Andresen
On Thursday 23 March 2006 23:48, JimD wrote: addkey() { sudo sh -c echo $* /etc/portage/package.keywords } For keywording I prefer to use this script: http://users.cybercity.dk/~dsl89966/keix It allows me to do: $ eix porth * app-portage/porthole Available versions: ~0.4.1

[gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
Hey, ho-- Here's (one of) today's non-critical problems that's getting on my nerves, so hopefully somebody can help. I've finally got around to setting up sudo. It works fine, except for one thing. I don't just give myself blanket permissions to sudo to all commands; I made a Cmd_Alias group

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread A. Khattri
On Wed, 6 Jul 2005, Holly Bostick wrote: Echo is in the sudo-ed group, and echo isn't the problem-- the problem is that permission is refused to write to the file itself (which is an error *from* echo, so it would seem that echo itself is OK as far as sudo goes). Which means that I have to su

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread gentoo
Le Mercredi, 6 Juillet 2005 15.52, Holly Bostick a ecrit : Hey, ho-- Here's (one of) today's non-critical problems that's getting on my nerves, so hopefully somebody can help. I've finally got around to setting up sudo. It works fine, except for one thing. I don't just give myself blanket

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Edward Catmur
On Wed, 2005-07-06 at 15:52 +0200, Holly Bostick wrote: Echo is in the sudo-ed group, and echo isn't the problem-- the problem is that permission is refused to write to the file itself (which is an error *from* echo, so it would seem that echo itself is OK as far as sudo goes). Which means

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
A. Khattri schreef: On Wed, 6 Jul 2005, Holly Bostick wrote: Echo is in the sudo-ed group, and echo isn't the problem-- the problem is that permission is refused to write to the file itself (which is an error *from* echo, so it would seem that echo itself is OK as far as sudo goes). Which

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
Edward Catmur schreef: On Wed, 2005-07-06 at 15:52 +0200, Holly Bostick wrote: Echo is in the sudo-ed group, and echo isn't the problem-- the problem is that permission is refused to write to the file itself (which is an error *from* echo, so it would seem that echo itself is OK as far as sudo

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread David Morgan
On 16:54 Wed 06 Jul , Holly Bostick wrote: OK, you all likely realize that I responded before I had got the three more messages telling me what to do. I'm sure it will work (three people telling you the exact same thing is pretty convincing ;-) ), but what I don't understand is why/how,

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
[EMAIL PROTECTED] schreef: Le Mercredi, 6 Juillet 2005 15.52, Holly Bostick a ecrit : Hey, ho-- I've finally got around to setting up sudo. It works fine, except for one thing. I made a Cmd_Alias group which includes a lot of utility apps. And, like many of you, I included emerge in this

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Neil Bothwick
On Wed, 6 Jul 2005 16:12:18 +0100, David Morgan wrote: Nope, I don't think you can do it with sudo since bash uses whitespace as a separator, so if you do sudo echo foo bar, it'll look for a single command echo foo bar, which is not what you want - you want a command echo with argument foo,

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Christoph Gysin
David Morgan wrote: afaik you can only do it with su -c echo foo bar, which stops bash from doing anything with the or the whitespace to begin with, but then passes everything inside the double quotes to another shell, which gets started by su -c It's kind of annoying, I know, but I don't

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Christoph Gysin
Holly Bostick wrote: I'm really lost. Where am I going wrong? check my other post. Oh, btw, just remembered-- this is bash 3. Does that make a difference? No. Christoph -- echo mailto: NOSPAM !#$.'*'|sed 's. ..'|tr * !#:2 [EMAIL PROTECTED] -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread gentoo
On Wednesday 06 July 2005 17.21, Holly Bostick wrote: To solve your problem, I would just do: chgrp -R portage /etc/portage chmod -R g+w /etc/portage Well, it didn't work (this to all the respondents). Are you in the portage group? sudo echo 'media-video/xine-ui ~x86'

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
Christoph Gysin schreef: David Morgan wrote: afaik you can only do it with su -c echo foo bar, which stops bash from doing anything with the or the whitespace to begin with, but then passes everything inside the double quotes to another shell, which gets started by su -c It's kind of

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Christoph Gysin
Holly Bostick wrote: Thank you, Christoph Your welcome. Last question on this subject-- is this all just bash scripting (so I can learn about it if I sit and study the abs-guide) or is there someplace else I should check out if I want to learn how to write this stuff myself? Yes, this

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Richard Fish
Holly Bostick wrote: I don't just give myself blanket permissions to sudo to all commands; I made a Cmd_Alias group which includes a lot of utility apps. And, like many of you, I included emerge in this group. Christoph Gysin schreef: $ sudo bash -c echo package ~x86

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
Richard Fish schreef: BTW Holly, You should recognize that from a security standpoint allowing yourself to execute bash is really giving yourself blanket permissions to sudo to all commands. You might as well make life easier on yourself and just make your sudo settings ALL=(ALL) NOPASSWD:

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Richard Fish
Holly Bostick wrote: Richard Fish schreef: BTW Holly, You should recognize that from a security standpoint allowing yourself to execute bash is really giving yourself blanket permissions to sudo to all commands. You might as well make life easier on yourself and just make your sudo settings

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Christoph Gysin
Holly Bostick wrote: Or is this not a valid proof that there are some limits left? Not, it's not. A simple sudo bash will give you a root shell. The problem in your example was the missing quotes: $ sudo bash -c /etc/init.d/samba restart Christoph -- echo mailto: NOSPAM !#$.'*'|sed 's. ..'|tr

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Holly Bostick
Richard Fish schreef: Holly Bostick wrote: Richard Fish schreef: BTW Holly, You should recognize that from a security standpoint allowing yourself to execute bash is really giving yourself blanket permissions to sudo to all commands. You might as well make life easier on yourself and

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Manuel McLure
Holly Bostick wrote: So it will. Shoot. Oh, well. Maybe I'll rework this, or I should then ask for: 1) firewall recommendations (personal, as the router has one too; atm I'm liking firestarter) I've been very pleased with Shorewall as a firewall. -- Manuel A. McLure KE6TAW [EMAIL PROTECTED]

Re: [gentoo-user] sudo echo cannot write to /etc/ files ?

2005-07-06 Thread Boyd Stephen Smith Jr.
Holly Bostick wrote: [EMAIL PROTECTED] schreef: I think the problem come from the fact that echo is sudo-ed but the shell redirection isn't. Compare this: su -c echo foo /etc/portage/whatever and su -c echo foo /etc/portage/whatever The first one will succeed, but not the second. Well,