Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 51

Thread: HowTO: Sudoers Configuration

  1. #31
    Join Date
    Mar 2009
    Beans
    927
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HowTO: Sudoers Configuration

    Quote Originally Posted by ibuclaw View Post
    Unless you've specified explicitly in /etc/hostname, localhost is not the hostname, localhost is just the alias to 127.0.0.1.

    So no, that won't work.

    Regards
    I know localhost is an alias for 127.0.0.1, but I don't see why 127.0.0.1 wouldn't work in sudoers?

  2. #32
    Join Date
    Jun 2010
    Beans
    1

    Re: HowTO: Sudoers Configuration

    Code:
    username HOST=(root)NOPASSWD:MYPROGS
    When i tried this code it says,
    bash: syntax error near unexpected token `('
    I'm using fedora 13 64 bit OS.
    I run this command on kernel on an intension to grant all priveleges to the root user without password prompts.
    Since I'm the only person to use my system i want no more password prompts while installing softwares or mounting hard disks.
    What will be the optimal solution for this ?

  3. #33
    Join Date
    Jan 2008
    Beans
    4,757

    Re: HowTO: Sudoers Configuration

    Quote Originally Posted by pradeeprajkumar View Post
    Code:
    username HOST=(root)NOPASSWD:MYPROGS
    When i tried this code it says,

    I'm using fedora 13 64 bit OS.
    I run this command on kernel on an intension to grant all priveleges to the root user without password prompts.
    Since I'm the only person to use my system i want no more password prompts while installing softwares or mounting hard disks.
    What will be the optimal solution for this ?
    Hmm... much to learn, you have. Hasty, you are. Perhaps reading the post from top down, and taking the time to understand it all, you must. Rather than skipping to the bits you are most interested in.

  4. #34
    Join Date
    Mar 2009
    Beans
    927
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HowTO: Sudoers Configuration

    Quote Originally Posted by Penguin Guy View Post
    I know localhost is an alias for 127.0.0.1, but I don't see why 127.0.0.1 wouldn't work in sudoers?
    I finally understand the whole host thing after reading this superuser answer.

  5. #35
    Join Date
    Sep 2010
    Location
    Kingdom of Bahrain.
    Beans
    3
    Distro
    Ubuntu

    Re: HowTO: Sudoers Configuration

    Very useful tutorial, thank you, ibuclaw!

  6. #36
    Join Date
    Oct 2010
    Location
    Australia
    Beans
    151
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HowTO: Sudoers Configuration

    This is an interesting tut, cheers! I'll use this later
    He peers into your SOUL

    Sorry if I multipost in any help threads I make, I'm an impatient human.

  7. #37
    Join Date
    Mar 2011
    Beans
    1

    Re: HowTO: Sudoers Configuration

    Dear Sir:
    In the sudoers file, I have defined a User_Alias list and a Cmnd_Alias list as follows:
    User_Alias ADMINS = lee, vbird
    Cmnd_Alias ADMINSCOM = !/usr/bin/passwd, /usr/bin/passwd [a-zA-Z]*, \
    !/usr/bin/passwd root
    ADMINS ALL=(root) ADMINSCOM


    My problem is that the Cmnd_Alias ADMINSCOM didn't work. But if I replace ADMINSCOM with !/usr/bin/passwd, it did work!
    Can you tell me why? Many Thanks!

  8. #38
    Join Date
    Mar 2011
    Beans
    1

    Re: HowTO: Sudoers Configuration

    Hi,

    Thanks for the article - it made a lot more sense than the man pages! I have a question about the following paragraph:

    A more secure method:
    %admin ALL=(root) ALL
    Where they will be instead denied if they try to run an application as another user.


    As I understand it, this will allow a member of the admin group to use sudo to invoke a command as root but not as any other user. This sounds like something we would definitely want to do, but my question is:
    Could members of this group bypass this restriction by using sudo to invoke another shell (e.g. sudo xterm)? Because (on my system at least) that new shell launches as root. As root in the second shell you can then run su to become another user.

    Thanks again.

  9. #39
    Join Date
    Jan 2006
    Beans
    52

    Re: HowTO: Sudoers Configuration

    Just wanted to say that this is one of the best written articles/how-tos on sudoers and sudo. I've been reading a ton of info just to remmember the stuff but for a bookmark I returned to this one, one of the first I've read today.

    Good stuff, thank you.

  10. #40
    Join Date
    Oct 2011
    Beans
    2

    Re: HowTO: Sudoers Configuration

    Hi Iain. This is indeed a very nice tutorial which got me started with the sudoers file a while ago. Now it's time for me to give some information back.

    The '*' match is very powerful, and can apply to anything in the command listing part of the configuration line, ie:
    Code:
    %admin jaunty=(root)NOPASSWD:/*/sbin/*
    This could match anything from all the files in '/usr/sbin/' to '/usr/local/sbin/' and even places such as '/home/user/sbin/' fall into the match. As such, it is advised that you use it wisely.
    I think you should add some information to this part of your tutorial, because /*/sbin/* could also become /etc/passwd. Let me show you the problem:

    Here are the relevant part of my sudoers file:
    Code:
    Defaults        env_reset
    # Host alias specification
    Host_Alias HOST = eniac
    Host_Alias LAN = 192.168.178.0/255.255.255.0
    Host_Alias HOME = HOST,LAN
    
    # Cmnd alias specification
    Cmnd_Alias CHOWN_CMD    = /bin/chown zero /home/*
    
    # User privilege specification
    root    ALL=(ALL:ALL) ALL
    zero HOME=(root) NOPASSWD:CHOWN_CMD
    Let me point out that i can only run the /bin/chown command as root:
    Code:
    0:zero@eniac:~$ sudo ls
    Password:
    Sorry, user zero is not allowed to execute '/bin/ls' as root on eniac.
    1:zero@eniac:~$
    One would think that since i got /home/* in my sudoers file, the use of the chown command is restricted to anything that is below /home/
    Well, unfortunatelly that is not the case.

    Code:
    0:zero@eniac:~$ ls -l /etc/passwd
    -rw-r--r-- 1 root root 531 Oct 12 20:51 /etc/passwd
    0:zero@eniac:~$ sudo chown zero /home/../etc/passwd
    0:zero@eniac:~$ ls -l /etc/passwd
    -rw-r--r-- 1 zero root 531 Oct 12 20:51 /etc/passwd
    To prevent this, you will have to restrict the use of ".." in the argument.
    Code:
    Cmnd_Alias CHOWN_CMD    = /bin/chown zero /home/*,\
    ! /bin/chown zero *..*

Page 4 of 6 FirstFirst ... 23456 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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