Unfortunately I was rushing and ran sudo chmod 777 -R / inside one project. Should I worry that it started to add 777 permission for all my folder starting from root (/) ?

  • if you actually typed chmod 777 -R / then everything is broken. / is the absolute path of the top level directory
    – Zanna
    Jul 27, 2017 at 13:17
  • Yeah, I am new in Linux, the price of learning. Thanks a lot, I will reinstall my computer.
    – πter
    Jul 27, 2017 at 13:20
  • Did you run it as root? (ie , logged in as root, or via sudo chmod ...) That could limit the damage done to the point where it might be reversible.
    – Oli
    Jul 27, 2017 at 13:23
  • Ran it via sudo. But after it executed more then a second I just realized that something is wrong so I killed the execution. So basically it was running for 2-3 seconds. But I think I will reinstall my computer anyway :) Thank your for your answers
    – πter
    Jul 27, 2017 at 13:26
  • 1 second is more then enough ;-) But there are ways to fix it without reinstalling. See if what I posted works for you :)
    – Rinzwind
    Jul 27, 2017 at 13:30

4 Answers 4


Should I worry that it started to add 777 permission for all my folder starting from root(/) ?

No, no need to worry. I can guarantee it if you used "sudo" in front of it or did a "sudo -i". Otherwise it should have shown a permissions error.

In case you want to restore your system there are ways to do this but you need a current (ie. up to date with your personal data) backup system. With ACL tools ...

  • you can do getfacl -R > permissions.txt from / on the backup system to create a list of permissions.

  • On the broken machine use a live session, copy the file to / and do setfacl --restore=permissions.txt in / to restore them.

I would advise you to re-install though.

  • Oh ! So nice to learn this. I will star this question for futur reference ! Jul 27, 2017 at 14:04
  • 3
    Leaving every file present on your local machine and not on the remote one with potentially broken permissions (world-write and world-execute, meaning even a completely untrusted account like nobody can alter an executable any other user might run) doesn't exactly strike me as adequate fix. Jul 27, 2017 at 15:44
  • Oh yes I agree on that :-)
    – Rinzwind
    Jul 28, 2017 at 5:37

Yes, you absolutely need to worry

You ran sudo chmod 777 -R /, which will recurse through the whole file system.

For most files, this is a minor inconvenience. For some files it will be a serious security risk (think /etc/passwdand the like), if some attacker manages to compromise your system via shell or CGI attacks.

But most importantly, some files break if they are too open. For example, if you open up ~/.ssh/* (your ssh keys, authorized_keys, hosts...), then ssh or sshd will treat those files as if they were not there, for security reasons. This could, worst case, mean that you become locked out of your own machine, if you relied on ~/.ssh/authorized_keys to log in via ssh+Public Key. There are also plenty of other security related software packages that do the same, mostly for their configurations in /etc or maybe some files in /var.

So while we obviously cannot say for sure as we know little about your machine. It is certainly not a harmless issue, as some of the other answers propose.


If you run:

readlink -f /var/www/html/../../..

You'll get / it means as you said it your self your command has been run on the /, simply your system is broken now, get a backup of your data, re-install the Ubuntu.

chmod's job is to change the mod (permission bit) of files/directories and 777 means every one can read, write, execute anything on your system, at the same time you have removed a lot of other bits like sticky, suid, sgid.

  • But only user root can do this. As a normal user, not much damage is done. Did OP run as root or not ?
    – Soren A
    Jul 27, 2017 at 13:24
  • Those are ellipses (i.e. ...), not ... He probably meant he was in a long subdirectory under /var/www/html, when he ran the command passing it / as an argument.
    – JoL
    Jul 27, 2017 at 17:56

On a point that hasn't been raised,

...it started to add 777 permission for all my folder starting from root...

You didn't just add 777 permissions, you removed the setuid, setgid, and sticky bit from all files. This'll cause things like sudo and su to stop working, since they rely on setuid to change users.

Note that chmod 777 is short for chmod 0777. That other octal digit represents the bits I just mentioned. For example, chmod 4777, sets the setuid bit, clears the setgid and sticky bit, and adds all permissions.

In the future, I suggest using chmod's other syntax:

chmod +rwx # what you probably intended
chmod ug+w # add write permission to user and group
chmod o-r # remove read permission from other

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