I'm only granting permission to all to do anything but why does the system crash by giving permissions only? I'm only modifying the permission not changing the files.
I'm only granting permission to all to do anything but why does the system crash by giving permissions only? I'm only modifying the permission not changing the files.
There are a couple of reasons.
First in addition to the usual read/write/execute permissions there are some other bits that file permissions contain. Most notably
setuid
andsetgid
. When a program with one of these permission bits is set is run it gets the "effective UID" and/or "effective GID" of the program's owner rather than the user that ran it. This allows programs to run with more permissions than the user that ran them. It is used by many crucial system utilities includingsu
andsudo
. Yourchmod
command clears these bits leaving the utilities unusable.Secondly some programs (notably
ssh
) do a sanity check on file permissions and refuse to use files with permissions they see as insecure. This reduces the risk of careless admins accidentally leaving security holes but it makes dealing with wiped-out file permissions all the more painful.A short answer.
Linux system requires specific permissions for certain programs like
sudo
, etc.When you run
chmod 777 -R /
you wipe all permissions and replace them with777
. This makes the system unusable unless you manually restore all the permissions.In practice it is much faster and easier to re-install.
The problem is that many system programs are designed a way that they do not start if they "do not like" the permissions. This is made for security reasons.
I think it is more important to explain how to handle the system design in paractice than to explain why each program fails to work with wrong permissons.
If you really want all users to have unlimited permissions in Ubuntu, you can add all users to the
sudo
group instead of changing file and directory permissions. That will have the same effect, but will not ruin the system.Another way (a very bad one) is to activate root account and allow everyone to login as root.
chmod
has subtle nuances.chmod 0777
behaves differently fromchmod u+rwx,g+rwx,o+rwx
in that the setuid and setgid are zeroed by the first and preserved by the latter.That is why the system became unusable. You removed necessary setuid from a few programs.
Here is a list of setuid or setgid files on my Linux Fedora 23 laptop:
I removed dozens of noise entries in caches and logs.
Additional to the other replies: you also removed the "sticky bit" from
/tmp
(which usually has permissions 1777), and this could cause other unexpected problems, as programs would be able to write to or delete each-others' temporary files.The sticky bit is a special permission which, whilst allowing anyone to create files in
/tmp
, only allows the person who created it to move or remove it.