How to reset or undo the changes made by sudo chmod -R 777 /usr/bin/ command?

Ravina Nitwal (Digital) 1 Reputation point
2020-01-16T05:10:39.257+00:00

I accidentally ran sudo chmod -R 777 command on /usr/bin/

And now I am getting the following error >>

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

I can't access the root as Azure VMs don't provide root password and can't use sudo.

Is there any way I can undo this or make sudo work again?
Can someone from the azure support team reset it using their root credentials??

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,085 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 18,352 Reputation points Microsoft Employee
    2020-01-17T00:04:14.667+00:00

    Hello,

    It looks like the permissions were changed for the sudo utility. You can log in the Serial Console via the Azure Portal with root user. Try this and let me know the results:

    1. Log into the system as the root user
    2. Run command: 'chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo'
    0 comments No comments