Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I'm using Ubuntu 14.04 and I run some command series on Terminal. But at one time I ran

sudo chmod 777 /usr/bin/ -R

And giving some permissions on this directory. After that, I'm continue my work, and I got this message:

sudo: /usr/bin/sudo, owned by 0 users identity and should be setuid  bit set

I'm new on Ubuntu, what should I do?

share|improve this question

marked as duplicate by Braiam, Radu Rădeanu, Warren Hill, Eric Carvalho, belacqua Jul 4 '14 at 17:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You'll need to start by getting root write access to /usr/bin/. You'll need recovery mode or even a Live CD/USB. Both those approaches are covered here — just ignore the password setting bit.

By this point you should be logged in as root.

Anyway fixing this isn't too hard because most of the files are straight 755 and there are only a handful of exceptions. So we'll start by setting everything in there to 755 and correct the exceptions. This is based off my filesystem so I've probably got a few things you don't but running chmod on a non-existent file shouldn't hurt.

chmod 755 /usr/bin/*

chmod 4755 /usr/bin/{{lp,g,}passwd,chfn,mtr,beep,traceroute6.iputils,pkexec,sudo,newgrp,ksu,chsh}
chmod 6755 /usr/bin/{X,at}
chmod 2755 /usr/bin/{mail-{un,touch,}lock,ssh-agent,mutt_dotlock,chage,bsd-write,wall,screen,crontab,mlocate,expiry,dotlockfile}

chmod 0755 /usr/bin/

This syntax is exact. You need to make sure it's entered correctly or it could break even more.

You could argue that this is too much to manually copy and paste. You might be right. We can handle the most important things and then reboot back into a graphical desktop to do the rest with sudo:

chmod 755 /usr/bin/*

chmod 4755 /usr/bin/{sudo,pkexec}
chmod 2755 /usr/bin/crontab
chmod 6755 /usr/bin/X

chmod 0755 /usr/bin/

For anybody curious on how to generate a list like that, here are the commands:

find /usr/bin -type f ! -perm 755 -printf '%m %P\n'

That does only look at files but all the links I could find linked back through to /usr/bin/ files so they were already being dealt with.

share|improve this answer
but the sudo is gonna still broken so he just should boot from cd/usb then repair – hwez Jul 3 '14 at 12:34
@hwez Yeah I thought the permissions being changed to 777 would let them change the permissiosn without sudo but I've just tested that on a Live ISO in Virtualbox and it doesn't seem to work. – Oli Jul 3 '14 at 13:47
He will need to set the setuid bit for that. There is a super package that provides a command to do that, but he will need to su to root, install that etc. Probably better to boot from Live media and repair. – Jos Jul 3 '14 at 14:04
I tried it on my own os – hwez Jul 3 '14 at 14:18

There's no solution for this bug at this moment because there no root user in ubuntu Linux os, what I'm trying to say is that issues is impossible to solve , 'you need the root access to give permission' , 'ubuntu root access by sudo' , 'sudo is broken' so you can't solve sudo when it doesn't work ,'su' command needs a root user, when you try give 755 permission with live CD/USB to the /usr/bin folder you'll need root access, when you use ' $ sudo ' it gonna use the the sudo off the bed wich we're trying to solve
there's only 1 solution for this witch is the issue that we're trying to fix.
and you can fix this issue by 're-install' boot CD/USB of the ubuntu , then in the installation type you have to choose update ubuntu then continue the installation .
if you ask why Ubuntu haven't made a root user it's for security , wich is make ubuntu secured better then some Linux os, if you asks why the root user isn't secured ?
the answer is gonna be : if someone got your root password & ssh port is on he gonna make a bigger issues then the one that we have

share|improve this answer

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