chmod 777
is very popular ownership command. 777
simply means give all rights to the all users. chmod 777
generally used to make operations more smoothly because it will remove all ownership related problems. We generally use chmod 777
some error message like below.
You don't have permission to access /bin/ on this server.
All Files and Directories Recursively
One of the most popular use case for chmod 777
is changing given directory and child directories permission recursively. We can use -R
option for this. In this example, we will change all directory named bin
and its subdirectories and files to 777
.
$ chmod -R 777 /bin
chmod 777 with sudo
We may need root privileges. In these situations we should use sudo
to get root privileges during the command execution.
$ sudo chmod -R 777 bin
Security Problems
Now it provides a lot of flexibility but running chmod 777
will create security problems. This will make all given files and directories read, write, and executable by all of the users. A user can change a system binary and escalate its credentials.