Chirag thaker
Chirag thaker

Reputation: 331

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

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 :)

Upvotes: 8

Views: 101637

Answers (15)

Hem
Hem

Reputation: 739

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.

Upvotes: 0

ken-andre
ken-andre

Reputation: 1

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.

Upvotes: 0

Anubhav Srivastava
Anubhav Srivastava

Reputation: 21

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.

Upvotes: 0

ParisaN
ParisaN

Reputation: 2092

Login as root by running command:

pkexec bash

Then run:

chown root:root /usr/bin/sudo
chmod u+s /usr/bin/sudo

Upvotes: 0

MiraTech
MiraTech

Reputation: 1342

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

Upvotes: 0

justme
justme

Reputation: 23

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

Upvotes: 2

Ritesh Rana
Ritesh Rana

Reputation: 61

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

Upvotes: 6

Bmaxtar
Bmaxtar

Reputation: 1

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

Upvotes: 0

user15419440
user15419440

Reputation: 1

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

Upvotes: 0

coolbeatz71
coolbeatz71

Reputation: 1107

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

Upvotes: 0

Netwons
Netwons

Reputation: 1648

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

Upvotes: 1

Abhi
Abhi

Reputation: 480

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

Upvotes: 26

Akane153
Akane153

Reputation: 1

Try this:

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

I've succeeded it

Upvotes: 0

Keval Mangukiya
Keval Mangukiya

Reputation: 2501

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....

Upvotes: 0

Related Questions