No sudo commands allowed anymore ( sudo: parse error in /etc/sudoers near line 21)

Hi threre,

I tried this tutorial to use my 433MHz actors.

After installing the exec-Binding, Raspberry-remote and editing the sudoers file like:

# User privilege specification
openhab ALL=NOPASSWD: /opt/raspberry-remote/send*

The error:

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


Now I can´t do an sudo- command anymore.
I tried copying the file out via SSH but I have no permissions.

pkexec visudo

is not working, because I have no password for root.

I´m a totally noob an only wanted to make my actors running.

Anybody who can help???

You will have to get the SD card out and edit the sudoers file in an other computer. Restore the file to what it was.
Every time you do something like this ALWAYS make a copy your original file under another name eg. myfile.bak. This way you can easily restore to when it was working and then you can try again!

Thanks for the Reply.

I´ve tried your way earlier, but I can´t download or edit the sudors file, because I´ve no permisson to do that…

Vincent has the solution.

You need to mount the SD card on some other machine where sudo is not broken and edit the sudoers from there. You will still need to be root (i.e. sudo) even on that other machine where you mount the SD card to to access the file.

And in the future, ALWAYS edit sudoers using visudo. If there is something wrong with what you changed, it will reject the change instead of breaking sudo on your machine.

If the SD card is mounted to /mnt/sdcard then the command would be

sudo visudo -f /mnt/sdcard/etc/sudoers

Once in a while, I come up with :laughing:

When I use my MAC, connect with cyberduck, Ißm not able to download that file, because of missing permissions…

How can I solve that problem?

Get the SD card Out and put in ANOTHER computer. Your mac for example. Then edit the file. Then put it back and start again.

I don’t know Mac or cyberduck. If you are root on the mac you should be able to edit the file. If it doesn’t work I’ve no ideas.

I´ve already tried this. Mounted the SD-Card to my mac, and had no permisson. I´ll try that again in half an our - first kids must go to bed :wink:

Get a proper computer. :wink:

I´m not able to edit the sudoers file.
Mounting it on a MAC or in WIN - I don´t have the permission…

No Ideas anymore…

I think I´ll have to configure the Raspberry completely new :smirk:

On what computer did you install openHAB?

Raspberry PI

Take the SD card out.
Put it in your mac
Edit the file

That doesnt work for me. If I mount the SD Card on my Mac I have only read-permissions…

I try.
If it works, how do I repair the sudors file?
THX a lot

Put back to what it was
If you can’t
You’ll have to format your card and start again

First of all, I have to thank you very much!!!

Downloading my sudoers file works now - the line including

openhab ALL=NOPASSWD: /opt/raspberry-remote/send*

is wrong. I hope deleting the line

openhab ALL=NOPASSWD: /opt/raspberry-remote/send*

solves my Problem!

Also as root I´m not able to edit or replace the sudoers file… :disappointed_relieved:

I think I will start completely new…