LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Linux AMI - Error: sudo: must be setuid root (http://www.linuxquestions.org/questions/linux-server-73/linux-ami-error-sudo-must-be-setuid-root-933556/)

fortran 03-09-2012 03:08 AM

Linux AMI - Error: sudo: must be setuid root
 
I am using Amazon Linux AMI. I do not have password of root. I am just a user.
I was executing commands using sudo. It did not ask me any password and command was executed fine.
Ex- sudo rm -r /home/username/directoryname
or sudo yum install software-name
and it was working fine.
But unfortunately I have set permission of /usr/bin is 777 (drwxrwxrwx).
that is why permission of /usr/bin/sudo is become 777 (-rwxrwxrwx).
Now when I am using any sudo command , I get an error
Code:

sudo: must be setuid root
whenever i use sudo, it says
Code:

sudo: must be setuid root
now i am not able to change permission of any file. it says
Code:

chmod: changing permissions of `filename': Operation not permitted
I do not have root password. even I am not permitted to see root directory.
Please solve this problem. I am not able to execute any command now.

TB0ne 03-10-2012 02:48 PM

Quote:

Originally Posted by pavi_kanetkar (Post 4622527)
I am using Amazon Linux AMI. I do not have password of root. I am just a user. I was executing commands using sudo. It did not ask me any password and command was executed fine. Ex- sudo rm -r /home/username/directoryname or sudo yum install software-name and it was working fine.

But unfortunately I have set permission of /usr/bin is 777 (drwxrwxrwx). that is why permission of /usr/bin/sudo is become 777 (-rwxrwxrwx). Now when I am using any sudo command , I get an error
Code:

sudo: must be setuid root
whenever i use sudo, it says
Code:

sudo: must be setuid root
now i am not able to change permission of any file. it says
Code:

chmod: changing permissions of `filename': Operation not permitted
I do not have root password. even I am not permitted to see root directory. Please solve this problem. I am not able to execute any command now.

Without the root password, the only possibility you have is to boot the machine into single-user mode, or via a rescue CD/DVD, and change permissions back. If you tried to Google for the error, you'd have found LOTS of information...some, even on this very site:
https://www.linuxquestions.org/quest...d-root-854117/

If you can't change permissions on a file, and you can't get root access or boot from CD/DVD, your only other hope is to restore that directory from backups, and exercise some caution in the future. That's why you should NEVER play around with root or sudo access, to avoid situations like this.

fortran 03-21-2012 01:05 AM

Quote:

Originally Posted by TB0ne (Post 4623605)
Without the root password, the only possibility you have is to boot the machine into single-user mode, or via a rescue CD/DVD, and change permissions back. If you tried to Google for the error, you'd have found LOTS of information...some, even on this very site:
https://www.linuxquestions.org/quest...d-root-854117/
If you can't change permissions on a file, and you can't get root access or boot from CD/DVD, your only other hope is to restore that directory from backups, and exercise some caution in the future. That's why you should NEVER play around with root or sudo access, to avoid situations like this.

I have said in my first line that "I do not have password of root. I am just a user." Please read it again.
If I would be root. I would not execute command using sudo and the problem will be solved long before posting here.

TB0ne 03-21-2012 09:45 AM

Quote:

Originally Posted by pavi_kanetkar (Post 4632230)
I have said in my first line that "I do not have password of root. I am just a user." Please read it again.
If I would be root. I would not execute command using sudo and the problem will be solved long before posting here.

Please read my reply, again:
Quote:

Originally Posted by TB0ne
Without the root password, the only possibility you have is to boot the machine into single-user mode, or via a rescue CD/DVD, and change permissions back. If you tried to Google for the error, you'd have found LOTS of information...some, even on this very site:

If you can't change permissions on a file, and you can't get root access or boot from CD/DVD, your only other hope is to restore that directory from backups, and exercise some caution in the future. That's why you should NEVER play around with root or sudo access, to avoid situations like this.

See the VERY FIRST part??...yes, I know you don't have the root password, and said that. After that, I gave you the options that you've got to GET the root password back, and change the permissions back on those files. And AGAIN, if you can't get root or boot to recovery mode, then restore the directory from backups, which will put the files/permissions back like they were.

So, you've been told:
  1. Boot to single-user mode, and change the permissions there
  2. Boot from CD/DVD into rescue mode, and change the permissions there
  3. Restore from backups
Those are your options, which you apparently missed the first time.


All times are GMT -5. The time now is 05:40 AM.