/etc/sudoers: syntax error near line 30

Hi,
I tried to follow these steps

How to to run sudo command without a password:

  1. Backup your /etc/sudoers file by typing the following command:
    sudo cp /etc/sudoers /root/sudoers.bak
  2. Edit the /etc/sudoers file by typing the visudo command:
    sudo visudo
  3. Append/edit the line as follows in the /etc/sudoers file for user named ‘vivek’ to run ‘/bin/kill’ and ‘systemctl’ commands:
    vivek ALL = NOPASSWD: /bin/systemctl restart httpd.service, /bin/kill
  4. Save and exit the file.

I am receiving the following error

/etc/sudoers: syntax error near line 30 <<<
sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
How to fix this? I am trying to reedit but I couldn’t.Please help on this.
Thanks.

Best regards,

Johnson Joseph

Hi @jjmaloth,

Welcome to nixCraft forum.

The syntax is correct. May I know your OS and can you paste your /etc/sudoers file:

sudo cat /etc/sudoers 

What is the output of the following command?

sudo visudo -c  

Hi Vivek,
Thanks for your reply. My OS is Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1018-gcp x86_64)
sudo cat /etc/sudoers when I apply, the following message:

/etc/sudoers: syntax error near line 30 <<<
sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Output command for Sudo visudo -c

/etc/sudoers: syntax error near line 30 <<<
sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
I can’t get the file.Please advise a way to send the file.
Thanks.
Best regards,
Johnson

This is the file.
curl -O https://raw.githubusercontent.com/harmony-one/auto-node/master/scripts/install.sh && chmod +x ./install.sh && ./install.sh && rm ./install.sh
Thanks Vivek.
Please check and advise.
Best regards,
Johnson