openHABian 'sudo' not possible anymore

Hi all,

unfortunately I do not know what I did, but I can’t execute commands as sudo anymore.
I get the following error:

[09:17:17] openhabian@openhabianpi:~$ sudo openhabian-config
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

What can I do?

  • openhab 3.0.0 - Release Build
  • Release = Raspbian GNU/Linux 10 (buster)
  • Kernel = Linux 5.4.79-v7+
  • Platform = Raspberry Pi 3 Model B Rev 1.2

Did you destroyed the permission structure of your entire filesystem?

I really have no idea what I did, but it looks like I destroyed something.

Just to show example output for some files’ permission execute and compare the result with the following output:

ls -l /usr/bin/su*
-rwsr-xr-x 1 root root  50648 Jan 10  2019 /usr/bin/su
-rwsr-xr-x 1 root root 147560 Jan 20  2021 /usr/bin/sudo
lrwxrwxrwx 1 root root      4 Jan 20  2021 /usr/bin/sudoedit -> sudo
-rwxr-xr-x 1 root root  51060 Jan 20  2021 /usr/bin/sudoreplay
-rwxr-xr-x 1 root root  34588 Feb 28  2019 /usr/bin/sum

You cannot fix this from the running system. Any command you’ll need to run will have to be run as root which can’t be logged into on raspbian.

You’ll have to mount this SD card to another Linux machine and change the file permissions and ownership on the sudo files.

However, these file permissions don’t just change themselves and if you don’t know what caused this to happen there is no reason to believe that this is the only problem that has been introduced. So you can spend hours and hours hunting down each and every strange behavior that crops up or you can cut your losses and restore from backup or, if you don’t have a backup rebuild. You should be able to copy your config files but you won’t be able to run openhab-cli backup to do so.

I totally agree with you. That’s why I have already started to completely set up my system again.
I’ve a backup and you are right I’m be able to copy the config files too.

Thanks a lot for your support.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.