Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When i type "sudo -i" on an EC2 instance, i get following error:

sudo: must be setuid root

Which means that someone has tampered with the sudo permissions. Now the only way to login to server and do administration was through "sudo -i". Is there any way i can get root access to server? or fix the sudo binary file setuid permission?

share|improve this question
    
If this was the only way why you asking if there is another way? –  Andrew Smith Jun 22 '12 at 17:10
    
I am not GOD of information on this world, so if i said this was the only way, that doesnt means that i know everything. and its Obvious that when i say this was the only way, then intention to ask question was that may be someone might know some other way to login. –  Farhan Jun 22 '12 at 17:57

3 Answers 3

up vote 2 down vote accepted

Actually i was able to login to server, i mounted thee partition of server into another server, set the suid and proper permissions, allowed root login and it worked.

share|improve this answer

This is a bad situation. If nobody else has root access and you can't use su there are very bad chances. I'd try to backup everything I can and start over.

share|improve this answer

Yes, try "su -", you need suid flag on that file.

[root@m-01 ~]# ls -l /usr/bin/sudo
---s--x--x. 2 root root 197536 Mar 23 19:55 /usr/bin/sudo
[root@m-01 ~]# ls -l /bin/su
-rwsr-xr-x. 1 root root 30092 Jan  5 21:37 /bin/su

You need also suid flag not disabled on the / filesystem.

[root@m-01 ~]# mount
/dev/xvda1 on / type ext4 (rw,noatime,grpquota,usrquota)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
share|improve this answer
    
i have already mentioned in my post that the suid is not set on it. its been removed. –  Farhan Jun 22 '12 at 17:04
1  
But you have two binaries, one "su" and another "sudo", so please check both - you have mentioned only "sudo", while "su" might be still OK. –  Andrew Smith Jun 22 '12 at 17:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.