Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: sudoers file

  1. #1
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    sudoers file

    Well i havnt edited the sudoers file before, and aparently it cant quite work when i try to edit it.

    What i want to do.
    I want my normal user to be able to do apt-get update/upgrade without giving the root password.

    What i have done
    Code:
    sudo visudo
    line added to the file
    Code:
    %my-normal-group-name ALL=(ALL) NOPASSWD:/usr/bin/apt-get
    Thanks on advance.
    Kind Regards

    i tried changing the line a little
    Code:
    %cristian ALL=(root) NOPASSWD:/usr/bin/apt-get
    but still i cant get the right permissions.
    Last edited by Drenriza; June 7th, 2010 at 08:57 AM.

  2. #2
    Join Date
    Apr 2007
    Beans
    40
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: sudoers file

    For a specific user:
    Code:
    cristian ALL=NOPASSWD: /usr/bin/apt-get
    For all users:
    Code:
    %users ALL=NOPASSWD: /usr/bin/apt-get

  3. #3
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers file

    What dont u put % infront of a username.

    Is it for groups only?
    Last edited by Drenriza; June 7th, 2010 at 10:14 AM.

  4. #4
    Join Date
    Apr 2007
    Beans
    40
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: sudoers file

    Exactly

  5. #5
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers file

    now ive done
    Code:
    cristian ALL=NOPASSWD: /usr/bin/apt-get
    and i still havnt the right permissions.

    edited: typo
    Last edited by Drenriza; June 7th, 2010 at 10:39 AM.

  6. #6
    Join Date
    Feb 2008
    Location
    Lancashire, UK
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: sudoers file

    Quote Originally Posted by Drenriza View Post
    now ive done
    Code:
    cristian ALL=NOPASSWD:/usr/bin/apt-get
    and i still havnt the right permissions.
    You have no space after ALL=NOPASSWD:

    See example in post #2.

  7. #7
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers file

    Code:
    cristian@cristian-laptop:~$ apt-get update
    E: Kunne ikke åbne låsefilen /var/lib/apt/lists/lock - open (13: Permission denied)
    E: Kunne ikke låse listemappen
    cristian@cristian-laptop:~$ cat /etc/sudoers
    cat: /etc/sudoers: Permission denied
    cristian@cristian-laptop:~$ sudo cat /etc/sudoers
    # /etc/sudoers
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the man page for details on how to write a sudoers file.
    #
    
    Defaults	env_reset
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    
    # User privilege specification
    root	ALL=(ALL) ALL
    
    # Allow members of group sudo to execute any command after they have
    # provided their password
    # (Note that later entries override this, so you might need to move
    # it further down)
    %sudo ALL=(ALL) ALL
    #
    #includedir /etc/sudoers.d
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    
    #cristians sektion
    cristian ALL=NOPASSWD: /usr/bin/apt-get

  8. #8
    Join Date
    Apr 2007
    Beans
    40
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: sudoers file

    I don't know if that is the problem but, try using spaces like this:
    Code:
    cristian ALL = NOPASSWD: /usr/bin/apt-get
    And one more thing. I hope you know that you still have to type:
    Code:
    sudo apt-get
    the only thing is that it will not ask for a password anymore. I'm asking this because I just made the same change in my sudoers file and it works fine.
    Registered Linux user #471617
    |Linux Newbie Guide|My Linux&stuff blog

  9. #9
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers file

    it works with
    Code:
    sudo apt-get
    cant you get it to work without the sudo? thats kinda annoying

  10. #10
    Join Date
    Apr 2007
    Beans
    40
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: sudoers file

    make an alias in .bashrc:
    Code:
    alias apt-get='sudo apt-get'
    Registered Linux user #471617
    |Linux Newbie Guide|My Linux&stuff blog

Page 1 of 2 12 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
  •