1

I mistakenly excuted:

$ sudo chmod -R 777 /*

I can not run sudo any more: I have tried changing the permissions with recovery mode but when I log in back into my account sudo is not still working.

5
  • 5
    By far the easiest solution is to re-install.
    – Panther
    Feb 24, 2015 at 16:33
  • Duplicate of askubuntu.com/questions/127446/…
    – Elder Geek
    Feb 24, 2015 at 16:35
  • What should be: -rwsr-xr-x 1 root root 156708 Feb 10 2014 /usr/bin/sudo As bodhi.zazen indicates you've done more wrong than you know. Never use -R with any command unless you know exactly what you are doing.
    – Elder Geek
    Feb 24, 2015 at 16:43
  • You just made every file 777 and that's waaaay bad for security. Please include why or how you know sudo is not working (post any error messages you received etc) so that we can help you figure out what the real problem was in the first place. Please explain in detail and we'll get to the bottom of this (you do need to re-install though) you can re-install and keep your home directory by choosing "something else" during installation, select the partition and choose format ext4 mount point "/". Then, uncheck or untick the reformat box so that the installation does not reformat the partition
    – mchid
    Feb 24, 2015 at 17:27
  • If you did not re-install yet see if below works.
    – Rinzwind
    Feb 24, 2015 at 18:49

1 Answer 1

2

I do agree that a re-install will be easier and it will have a predicted result (a total recreation of all permissions) but it is possible to do this without a re-install using "acl". On the desktop editions "acl" is installed by default.

Now the problem is that because you messed up "sudo" and probably did not create a collection of permissions you will need an outside source. If you have another system you can make these files yourself with the command below. If you do not have a 2nd machine I created a permissions file of all the files in /usr/ (/etc/ and /var/ are included below too) with

getfacl -R / > /tmp/permissions_usr.acl

and uploaded it to dropbox (12Mb). Download it and store it somewhere (I will assume /tmp/)With the command

setfacl --restore=/tmp/permissions_usr.acl

you can restore the file properties. But you will need a root prompt for this so will have to reboot into recovery mode from grub (see How do I boot into recovery mode?)


Same permissions file created for


These 3 files are all like this:

$more permissions_etc.acl 
# file: etc
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

# file: etc/signond.conf
# owner: root
# group: root
user::rw-
group::r--
other::r--

# file: etc/hp
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

...
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .