Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Regular user access to stop/start net.eth0? [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6347
Location: /usr/lib64/lv2

PostPosted: Sat Jan 22, 2011 10:15 pm    Post subject: Regular user access to stop/start net.eth0? [SOLVED] Reply with quote

How do I give my regular user access to control my nic? I want to write a script to stop net.eth0, run a program, and start net.eth0 when the program is finished, without having to sudo.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.


Last edited by audiodef on Wed Jan 26, 2011 1:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
boerKrelis
Apprentice
Apprentice


Joined: 01 Jul 2003
Posts: 241
Location: The Netherlands

PostPosted: Sat Jan 22, 2011 10:35 pm    Post subject: Reply with quote

Why not set sudo up to let the user do just that, without a password?
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6347
Location: /usr/lib64/lv2

PostPosted: Sat Jan 22, 2011 11:09 pm    Post subject: Reply with quote

How do I do that?
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
boerKrelis
Apprentice
Apprentice


Joined: 01 Jul 2003
Posts: 241
Location: The Netherlands

PostPosted: Sun Jan 23, 2011 12:07 am    Post subject: Reply with quote

Have a look at the sudo documentation. I think you could do something like this (in /etc/sudoers. you edit it by running 'visudo':

someuser ALL=(someotheruser) NOPASSWD: /path/to/somecommand -arg1 -arg2

resulting in 'someuser' being able to run:
'sudo -u someotheruser /path/to/somecommand -arg1 -arg2 --maybe-some-other-arg'
without being prompted for a password.

So in your case this would be like

you ALL=(root) NOPASSWD:/etc/init.d/net.ethX


Sudo is way more powerful than most people think.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6347
Location: /usr/lib64/lv2

PostPosted: Sun Jan 23, 2011 4:58 pm    Post subject: Reply with quote

Last night, I realised - duh! Visudo! :P Thanks for confirming that.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6347
Location: /usr/lib64/lv2

PostPosted: Mon Jan 24, 2011 9:17 pm    Post subject: Reply with quote

Not sure what I'm missing. I've used visudo to make it possible to reboot and shutdown from the Fluxbox menu (not related to the topic, but just to say I've done this before). I added this line:

audiodef ALL = (root) NOPASSWD:/etc/init.d/net.eth0

and as my regular user I still get a warning about needing to be root.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
boerKrelis
Apprentice
Apprentice


Joined: 01 Jul 2003
Posts: 241
Location: The Netherlands

PostPosted: Tue Jan 25, 2011 12:36 am    Post subject: Reply with quote

When do you get this warning? How are you invoking /etc/init.d/net.eth0 (what do you type on the commandline) ?
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6347
Location: /usr/lib64/lv2

PostPosted: Tue Jan 25, 2011 3:32 pm    Post subject: Reply with quote

The usual. I tried, as my regular user, /etc/init.d/net.eth0 stop.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
phajdan.jr
Retired Dev
Retired Dev


Joined: 23 Mar 2006
Posts: 1777
Location: Poland

PostPosted: Tue Jan 25, 2011 3:47 pm    Post subject: Reply with quote

audiodef wrote:
The usual. I tried, as my regular user, /etc/init.d/net.eth0 stop.


Did you mean "sudo /etc/init.d/net.eth0 stop"?
_________________
http://phajdan-jr.blogspot.com/
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6347
Location: /usr/lib64/lv2

PostPosted: Wed Jan 26, 2011 1:53 pm    Post subject: Reply with quote

phajdan.jr wrote:
audiodef wrote:
The usual. I tried, as my regular user, /etc/init.d/net.eth0 stop.


Did you mean "sudo /etc/init.d/net.eth0 stop"?


Whoops. :oops: Now it works fine. Please brain my excuse damage!

Thanks, boerKrelis and phajdan.jr.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum