1

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?

2 Answers 2

4

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

USERCTL=yes

Then any user can run ifup em1/ifdown em1.

1
  • 1
    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. Oct 23, 2012 at 16:27
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .