Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    /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 .
    Debian Jessie x86_64 & armhf :: LibreELEC is the solution for your Linux-based HTPC setups.

  3. #3
    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. $spacer_open
    $spacer_close
  5. #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.
    Debian Jessie x86_64 & armhf :: LibreELEC is the solution for your Linux-based HTPC setups.

  6. #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!

  7. #6
    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

  8. #7
    Quote Originally Posted by alain_
    is the user "moderator" also in the group wheel?
    not sure of that? how can I know

  9. #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!

  10. #9
    Do I have to Uncomment this line?

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

  11. #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!

Posting Permissions

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