What "chmod 777 -R / " does in /var/www/html/.../.../.../? [duplicate]
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 dosetfacl --restore=permissions.txt
in/
to restore them.
I would advise you to re-install though.
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/passwd
and 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.