/usr/bin/sudo must be owned by uid 0 and have the setuid bit set version .ubantu14.04 LTS
Asked Answered
B

15

8

when I set the EACCESS for npm and I was ran the chown command in my terminal for change owner permission but now i stuck in this sudo :" /usr/bin/sudo must be owned by uid 0 and have the setuid bit set" my version is : ubuntu14.04 LTS please help me guyz :)

Byron answered 3/5, 2016 at 12:9 Comment(3)
Did you do what it says to do at this link: docs.npmjs.com/getting-started/fixing-npm-permissions That is the most brain-dead method of forcing an install to work I have ever seen. chown -R myuser /usr/local? Even for /usr/local, that is epically stupid. And you've apparently found out why.Convexoconcave
finally, after finding too much i am really thanked askubuntu.com/users/10962/user10962 at this link : askubuntu.com/a/471503/528411Byron
/usr/bin/sudo mv /usr/local/bin/sudo{,2} hash -r Refer this unix.stackexchange.com/questions/419122/…Intrauterine
D
26

First restart your pc, and press the ESC key while Ubuntu is booting.

This will bring you up the boot menu.

Select Advanced Options.

Select your OS version in (recovery mode), and press Enter Key.

It will bring you up another screen. Now select “Drop to root shell prompt” and press Enter.

It will load a command line at the bottom of the screen.

Now run each of the following commands.

mount -o remount,rw /
mount --all
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
shutdown -r now
Daggerboard answered 3/9, 2019 at 8:0 Comment(9)
How to do the same on EC2 AWS?Anemoscope
WOrked like a charm... THANK YOU1Silici
Worked perfectly on Mint 19.3Jaramillo
This worked perfectly on ubuntu 20.04 i had ran sudo chmod -R 777 on /bin and the solution workedEstivate
Now i m facing mysql community service could not start error after login in user UbuntuPredecease
You are a savior!! This worked like charm!! Thanks!Countrywide
You really saved my day :PGujranwala
Thanks!!!! worked on vbox guest fineUnrealizable
Worked for me, I used below command as I was not getting the Advanced Options, $ init 1 $ mount -o remount / $ chown root:root /usr/bin/sudo $ chmod u+s /usr/bin/sudo $ reboot as suggested by @James Risner & @justme in this thread and it worked for me. :)Sobranje
S
5

If you have root user password then:

1.Login as root user

2.open terminal

3.Enter following cmd's:-

mount -o remount /
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
chown root:root /usr/lib/sudo/sudoers.so && chmod 4755/usr/lib/sudo/sudoers.so
chown root:root /var/* && chmod 4755 /var/*

If you do not have root user password then:

1.Reboot your system in recovery mode(boot and press and hold esc button to enter in recovery mode)

here it looks like

2.Nevigate to (advance option for linux) by using down arrow button and press two times Enter

here it looks like

3.Nevigate to root by using down arrow button and press Enter

here it looks like

4.Now enter following cmd's:-

mount -o remount /
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
chown root:root /usr/lib/sudo/sudoers.so && chmod 4755/usr/lib/sudo/sudoers.so
chown root:root /var/* && chmod 4755 /var/*

5.press ctrl+d and then select resume option to boot normal

Kudos you have made it

Schlemiel answered 25/8, 2022 at 4:31 Comment(0)
T
2

For me, I solved this by running these commands:

 $ init 1 
 $ mount -o remount /
 $ chown root:root /usr/bin/sudo
 $ chmod u+s /usr/bin/sudo
 $ reboot
Tocharian answered 6/11, 2022 at 8:38 Comment(2)
This has worked for me. I didn't have any access of root user, but after following these commands, I got it working. Thanks @James Risner and justmeSobranje
best answer! fast forwardHassler
I
1

/usr/bin/sudo mv /usr/local/bin/sudo{,2} hash -r

Refer this https://unix.stackexchange.com/questions/419122/sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set?newreg=b2490740fb214ce79c316ad76f859e0a

Intrauterine answered 27/5, 2019 at 19:47 Comment(0)
L
1

Simple fix

1-enter image description here

2-select recovery

3-select root

4-mount -o remount,rw /

5-chmod u=rwxs,g=rx,o=rx /usr/bin/sudo /usr/bin/pkexec

6-reboot or exit

Lipoprotein answered 2/4, 2021 at 10:34 Comment(0)
F
0

Its beacuase of Permission issue

 $ su
 Password: <type your root password>

Switch to root user and run the command

# pkexec chmod a=rx,u+ws /usr/bin/sudo

Then check it by typing from the user

$sudo -l

it Works fine for me

Cheers....

Ftlb answered 19/9, 2018 at 6:51 Comment(0)
G
0

Try this:

pkexec chown root:root /etc/sudoers /etc/sudoers.d -R

I've succeeded it

Grantham answered 24/4, 2019 at 15:12 Comment(0)
Z
0

To solve this issue, you need to boot into recovery mode which provides a scroll-down menu with an option to drop down to a root shell.

And type these commands one after another:

# remount disks in read-write mode
mount -o remount,rw /
mount --all

# return ownership
chown root:root /usr/bin/sudo

# fix permissions
chmod 4755 /usr/bin/sudo

After that, you can reboot and log in again.

You may try this, to know if It worked:

sudo -l
Zibet answered 24/11, 2021 at 17:41 Comment(0)
D
0

1- Alt + Ctrl + mode + F1

if login root ok if not do is

2- Alt + mode + F1

than do to path /usr/bin

3- cd /usr/bin than do is

chmod u+s sudo su mount umount sg pkexec ping passwd newuidmap newgrp newgidmap ksu gpasswd fusermount expiry chsh chfn chage unix_chkpwd

than do is

chmod g+s wall write locate unix_chkpwd

than change passwd root passwd

4- Alt + Ctrl + mode + F7

Or

5- Alt + mode + F7

than try su to login root

su

if not work do it again and change passwd user and root example my user is mizel

6- su - mizel

root only

7- su

Dishwater answered 24/12, 2021 at 16:15 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Lascar
K
0

This worked for me

“sudo: /usr/bin/sudo must be owned by uid” Or sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. Reason :This error occurs when incorrect permission or ownership is set on /usr/bin/sudo file.

Solution

Step 1 : Start the server in Single user mode using command at start.

  1. init 1

Step 2 : Once single user mode starts use below commands

  1. mount -o remount,rw /
  2. - chown root:root /usr/bin/sudo
  3. - chmod 4755 /usr/bin/sudo

Step 3: Now Reboot the Server and check.

  1. reboot //(linux command line)

enter link description here

Keating answered 5/7, 2022 at 11:58 Comment(0)
S
0

This applies to those environments where they have a docker/Kubernetes environment running and have a host root file system mounted into the container or pod.

In this case, the host's root / is mounted as /host inside the pod.

kubectl exec -it mypod -- chown root:root /host/usr/bin/sudo && chmod 4755 /host/usr/bin/sudo

I have not tried creating a fresh Kubernetes pod but I guess, that should work too.

Stupa answered 13/6, 2023 at 22:38 Comment(0)
H
0

This is pretty fast forward solution to the issue:

Step 1:

 $ init 1

Step 2:

 $ mount -o remount /

Step 3:

 $ chown root:root /usr/bin/sudo

Step 4:

 $ chmod u+s /usr/bin/sudo

Step 5:

 $ reboot
Hassler answered 2/11, 2023 at 12:57 Comment(0)
A
0

Login as root by running command:

pkexec bash

Then run:

chown root:root /usr/bin/sudo
chmod u+s /usr/bin/sudo
Arango answered 28/11, 2023 at 6:36 Comment(0)
D
0

This worked for me to hanldle this issue I used this command to become a root user:

systemd-run --shell

after that: chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

My problem is solved.

Detergency answered 26/1 at 19:15 Comment(0)
J
0

This is my first time as Ken-Andre to write on this channel, because all answer gave here semms so difficult, where for my case i found on other channel, more easier:

  1. systemd-run --shell
  2. chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

Hope, that it will work for you too.

Jaquelynjaquenetta answered 7/7 at 21:1 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Lascar

© 2022 - 2024 — McMap. All rights reserved.