[Solved] sudo: /bin/sudo must be owned by uid 0 and have the setuid bit set | Linux | Big Data

In this post, we will explain how to resolve the  sudo access related issue in  Red Hat  Enterprise Linux 8 distribution in the Big Data environment.

Here we gave access to one user  after We provided sudo access as well but get, that user tries to login with sudo access getting below error.

Error: sudo must be owned by uid 0 and have the setuid bit set

[root@sreekanth~]#sudo -i
sudo: /bin/sudo must be owned by uid 0 and have the setuid bit set


Step 1: First, login with root user then execute below command:

[root@sreekanth~]# pkexec chmod 4755 /usr/bin/sudo

Step 2: After executed the above command, then will execute the below command:

[root@sreekanth ~]# pkexec 4755 /usr/bin/sudo

Here pkexec command means that it allows an authorize/license user to execute Program/Computing as another username/userid. If username/userid  is not identified, then the program will be executed as the administrative super user, root.

Step 3: Then try to switch with sudo user:

[root@sreekanth ~]# sudo -i

In this time, it will ask root password. If it will not ask password it may cause pkexec command is not working on this user. Then check with user access using below command

[root@sreekanth ~]# id sreekanth.t

Here we used id with my username, will get which groups are assigned to me.
Basically id command in Linux is used for find out group names UID information.

Summary: The above resolution is very simple to solve the sudo access related issue in Linux distributions or Hadoop distributions in Big Data environment for all Linux/Hadoop admins. Basically, these things happens for only sudo user or root users.