Re: unable to do sudo as there is an error in sudoers.d

31 views
Skip to first unread message

Kyle Brown

unread,
Oct 18, 2016, 1:20:12 PM10/18/16
to Aarthi Swaminathan, CoreOS User
Aarthi,


Ideally you should use the visudo command to manage sudo users. visudo checks the file syntax before actually overwriting the sudoers file. This command should be ran as root to avoid losing sudo access in the event of a failure.

It is required that you specify which file you are attempting to edit with the -f argument: 

# visudo -f /etc/sudoers.d/test

As for recovering sudo on the box with a malformed sudo config. The process will depend on which platform (AWS, GCP, baremetal, qemu etc) you are using. On AWS I was able to stop my instance,  detach the ebs volume, attach this volume to another host, mount the root partition, and delete the /etc/sudoers.d/dummy file, then reattach this volume to my instance. 

Cheers,
Kyle Brown




On Thu, Oct 13, 2016 at 12:19 AM, Aarthi Swaminathan <aar...@magellanix.com> wrote:
1.I have created user with password
2.did  echo "dummy ALL=(ALL) 123abc: ALL" > /etc/sudoers.d/dummy
3. i logged in as user and tried sudo im getting error as 

>>> /etc/sudoers.d/dummy: syntax error near line 1 <<<
sudo: parse error in /etc/sudoers.d/hipadmin near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

4.Now im unable to edit the files as i dont have permission and i dont have password for root

please suggest as it is high priority to work with sudo access for user

--
You received this message because you are subscribed to the Google Groups "CoreOS User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coreos-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages