Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to allow users to control the em1 device in Linux:

When I run this command:

ifdown em1 

em1 is the embedded ethernet card 1, I want the user to be able to turn off the ethernet card.

On Fedora 17, I get this error message:

Users cannot control this device

I want a certain user to be able to run a certain command on Linux without giving rights to other users. What is the best way to do that?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Add this line to /etc/sysconfig/network-scripts/ifcfg-em1:

USERCTL=yes

Then any user can run ifup em1/ifdown em1.

share|improve this answer
    
I added the USERCTL="yes" line (with quotes) and it worked for me. That is a much better solution than using visudo. +35 serotonin boost points for you. –  Eric Leschinski Oct 23 '12 at 16:27
add comment

You can use sudo to give the user on Fedora 17 the rights to control the em1 device:

First verify that you infact cannot run ifdown em1 as a user.

el@defiant ~ $ /usr/sbin/ifdown em1

    Users cannot control this device.

Login to a terminal as root

su
<password>

Install sudo if you don't already have it

yum install sudo

open up the visudo permissions editor

Note, if you don't know how to use the vi editor, you'll either have to learn how or set the visudo path to editor as something else.

visudo

this allows you to edit what users can do which commands as root on your system

At the bottom of the file that is opened add these commands:

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now
%users  localhost=/usr/sbin/ifdown

Save the visudo file, Get out of root, login as a user, and see if you can control em1

el@defiant ~ $ /usr/sbin/ifdown em1
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.