0

Before anything I know that there is a similar question HERE.

When I execute:

sudo bash 

I get the following error:

/usr/bin/sudo must be owned by uid 0 and have the setuid bit set

However, there is a difference in my problem that does not permit me to solve it using that solution proposed as follows:

1. Log out as the current user, then log back in as root.
2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
3. Log out as root, then log back in as the current user. 

Because I cannot log in as root.

My question is how can I log in as root to do first step ?
i.e. 1. Log out as the current user, then log back in as root.

Questioner
  • 101
  • 1
  • 2
  • 2
    How exactly did you mess the permissions up? Can you still use `pkexec` instead of `sudo` or did you break that one too? – Byte Commander May 09 '18 at 12:23
  • Please update your question with the output from `ll /usr/bin/sudo` – WinEunuuchs2Unix May 09 '18 at 12:34
  • @WinEunuuchs2Unix I do not know `ll /usr/bin/sudo` what does it mean ? could you please explain a bit more ? – Questioner May 09 '18 at 14:02
  • If you type in the command it will show you the programs attributes. Then copy and paste the terminals output into your question. Don't use screen snapshot because those are hard to read. Thank you. – WinEunuuchs2Unix May 09 '18 at 15:10

2 Answers2

1

You could boot from a USB thumb drive, mount your root file system and then chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo. After a reboot, sudo should be working again.

nagelp
  • 383
  • 2
  • 8
  • 1. sudo is under `/usr/bin/sudo`, not `/usr/sbin/sudo` 2. If you mount the filesystem under for example `/mnt`, then the actual path will be `/mnt/usr/bin/sudo`. – raj May 24 '22 at 22:05
  • Re 2: You're right, one would have to account for the mount prefix, thanks for pointing that out. Re 1: I didn't write /usr/sbin? – nagelp May 25 '22 at 05:10
0
  1. Log out as the current user, then log back in as root.
  2. Execute apt-get remove sudo -y && apt-get install sudo -y
  3. Log out as root, then log back in as the current user.

This action will reset all permission to default state