Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
I have edited the file /etc/sudoers in order to allow my self to run some commands with not having the need to access the root account, this is my file ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Posts
    12

    /etc/sudoers -- support


    I have edited the file /etc/sudoers in order to allow my self to run some commands with not having the need to access the root account, this is my file

    I have added those lines but its not seem to be working, could someone correct me, Thanks.

    moderator ALL=/sbin/ifconfig, /sbin/ifconfig eth0 *, /etc/rc.d/rc.inet1 start
    moderator localhost=/sbin/shutdown -h now

    Code:
    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    
    # Defaults specification
    
    # Runas alias specification
    
    # User privilege specification
    root    ALL=(ALL) ALL
    moderator ALL=/sbin/ifconfig, /sbin/ifconfig eth0 *, /etc/rc.d/rc.inet1 start
    moderator localhost=/sbin/shutdown -h now
    
    # Uncomment to allow people in group wheel to run all commands
    # %wheel        ALL=(ALL)       ALL
    
    # Same thing without a password
    # %wheel        ALL=(ALL)       NOPASSWD: ALL

  2. #2
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Belgium
    Posts
    1,429
    Have you edited it with the visudo command? And you don't respect the syntax... Should be [user] ALL=(ALL) command.

    I suggest you do some reading on sudo before starting to mess with it .
    ** Registered Linux User # 393717 and proud of it ** Check out www.zenwalk.org
    ** Zenwalk 2.8 - Xfce 4.4 beta 2- 2.6.17.6 kernel = Slack on steroids! **

  3. #3
    Just Joined!
    Join Date
    Feb 2005
    Posts
    12
    Quote Originally Posted by borromini
    Have you edited it with the visudo command? And you don't respect the syntax... Should be [user] ALL=(ALL) command.

    I suggest you do some reading on sudo before starting to mess with it .
    I did some reading.

    thats how I open the file
    cd /etc
    then
    visudo

    when I looked at the example in the file
    # %users localhost=/sbin/shutdown -h now

    I just simple replaced the %users with the username 'moderator'

  4. #4
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Belgium
    Posts
    1,429
    Do it like this:
    # visudo -f /etc/sudoers


    That way visudo will check the syntax when you close the modified file. Have you checked if the path is correct?

    Anyway, I checked some info on visudo, you do respect the syntax . My bad! I don't know if you can add more commands to one line though. I think you should put one line for each command.
    ** Registered Linux User # 393717 and proud of it ** Check out www.zenwalk.org
    ** Zenwalk 2.8 - Xfce 4.4 beta 2- 2.6.17.6 kernel = Slack on steroids! **

  5. #5
    Linux Newbie
    Join Date
    Jul 2005
    Location
    ~/home
    Posts
    105
    Code:
    moderator ALL=/sbin/ifconfig, /sbin/ifconfig eth0 *, /etc/rc.d/rc.inet1 start
    try it without the spaces between the commands, and remove the wildcard (*).

    is the user "moderator" also in the group wheel?
    Help me getting a Opera licence
    Beginning with debian? -> read THIS!

  6. #6
    Just Joined!
    Join Date
    Feb 2005
    Posts
    12
    aint working, that paths are correct, if i do

    moderator ALL=/sbin/ifconfig eth0 down

    i got permission denied

    Code:
    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    
    # Defaults specification
    
    # Runas alias specification
    
    # User privilege specification
    root    ALL=(ALL) ALL
    moderator ALL=/sbin/ifconfig
    moderator ALL=/sbin/ifconfig eth0 down
    moderator ALL=/etc/rc.d/rc.inet1 start
    moderator localhost=/sbin/shutdown -h now
    and this is when i close the file:

    skipping 3 old session files
    reading /etc/sudoers.tmp

  7. #7
    Just Joined!
    Join Date
    Feb 2005
    Posts
    12
    Quote Originally Posted by alain_
    is the user "moderator" also in the group wheel?
    not sure of that? how can I know

  8. #8
    Linux Newbie
    Join Date
    Jul 2005
    Location
    ~/home
    Posts
    105
    Code:
    grep wheel /etc/group
    and see if moderator is in it.
    Help me getting a Opera licence
    Beginning with debian? -> read THIS!

  9. #9
    Just Joined!
    Join Date
    Feb 2005
    Posts
    12
    Do I have to Uncomment this line?

    # Uncomment to allow people in group wheel to run all commands
    # %wheel ALL=(ALL) ALL

  10. #10
    Linux Newbie
    Join Date
    Jul 2005
    Location
    ~/home
    Posts
    105
    if you uncomment that line, everybody who is member of the group wheel can give "all" commands,'
    i don't hink you want that
    but it could be usefull to debug
    Help me getting a Opera licence
    Beginning with debian? -> read THIS!

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •