Results 1 to 8 of 8

Thread: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

  1. #1
    Join Date
    May 2010
    Location
    New Mexico, USA
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    I managed to somehow mess-up /etc/sudoers file and now I am unable to access it. I added 2 users to the file using 'sudo visudo' command and apparently messed something up. Here are the results of attempts to access file:
    Code:
     jane@gdawg-Inspiron-530s:~$ sudo visudo
    sudo: >>> /etc/sudoers: syntax error near line 9 <<<
    sudo: >>> /etc/sudoers: syntax error near line 9 <<<
    sudo: parse error in /etc/sudoers near line 9
    sudo: no valid sudoers sources found, quitting...
    sudo: unable to initialise policy plug-in
    I recently installed Ubuntu Remix. All help is welcome.

    Linux gdawg-Inspiron-530s 3.2.0-27-generic-pae #43-Ubuntu SMP Fri Jul 6 15:06:05 UTC 2012 i686 i686 i386 GNU/Linux

  2. #2
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    Take a look at psychocat's page on fixing sudo:
    http://www.psychocats.net/ubuntu/fixsudo
    Back to Xorg...

    Retired.

  3. #3
    Join Date
    Feb 2012
    Location
    Athens/Greece
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    Hi ,

    please open a terminal and run
    Code:
    pkexec gedit /etc/sudoers
    copy-paste below code inside (DELETE everything else , if any)
    Code:
    # /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
    save the file , and tell me if your problem fixed.

    Thanks

  4. #4
    Join Date
    May 2010
    Location
    New Mexico, USA
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    Thanks for the replies. Tried both suggestions and neither worked. Psychocat's method had me boot into recovery mode, select "drop to root shell prompt", enter "mount -o rw, remount /" and response is "mount: special device remount does not exist".
    NikTh's method produced this result:
    Code:
     jane@gdawg-Inspiron-530s:~$ pkexec gedit /etc/sudoers
    Cannot open display: 
    Run '/usr/bin/gedit --help' to see a full list of available command line options.
    
    ** (gedit:2533): WARNING **: Command line `dbus-launch --autolaunch=89df75f973f485e2fea070210000000c --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
    I don't know what else to try. Thanks again.

  5. #5
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    try psychocat's method again, you mistyped the mount command - there should be no space after the comma between the options rw,remount

    Code:
    mount -o rw,remount /
    (with the space there it treats 'remount' as a block special device not a second option)

  6. #6
    Join Date
    May 2010
    Location
    New Mexico, USA
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    Thank you steeldriver. It's finally fixed. I had to deviate some from psychocat's instructions. My situation fit "Case 2" of repair instructions but it wouldn't work with any sudo command so I entered "visudo" at root prompt and then used NikTh's "/etc/sudoers" sample file to correct the file.
    Thanks to all for your excellent help.

    Regards,

    Glen

  7. #7
    Join Date
    Feb 2012
    Location
    Athens/Greece
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    Hi ,
    glad you solved .

    For future knowledge (maybe): If I understood correctly you applied command I gave you from recovery mode. Gedit its a graphical application and cannot be applied with no Desktop environment. It was my mistake I didn't mention that.
    You should apply the command from your Desktop environment (nor Recovery mode or Console)
    or else you should be run nano instead .
    Code:
    pkexec nano /etc/sudoers
    Thanks

  8. #8
    Join Date
    Mar 2013
    Beans
    2

    Re: Can't Access Sudoers File in Ubuntu, Kubuntu, Xubuntu

    Thanks Nikth,

    Your file worked.

    Dear fellas, If you cant open the sudoers file then just make a newfile in home dir and then sudo paste it in /etc with name sudoers.

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
  •