Hardware Reference
In-Depth Information
chown
As mentioned previously, Linux is a multiuser system and all the files have an
owner. Sometimes, the owner needs to be changed. To do this, use the chown
command. chown can change the user of a file or directory.
A good example of permissions in use is the Apache web server. All the
configuration files in the /etc/apache2 directory are owned by the Apache2
user, along with the files located in the /var/www directory where the website
that Apache2 is serving.
Sometimes, when you add a file to this directory, you need to change the owner
to be the Apache2 web server. If you don't do this, Apache2 won't be able to serve
the file to anyone who wants to take a look at it.
chown needs several parameters. They are the new owner and the group of the file
or directory that you want to change the owner of.
Changing the owner of all the files in Apache2's web root
The owner and group need to be separated by a ( : ). In the preceding example,
the user and group are both Apache2.
There are several different options that you can add to the chown command,
as follows:
Option
Description
-R
This changes the owner of all the files and folders in the folder recursively
-v
This displays a message for every file that is processed
Some of the chown command's parameters
chmod
The other part of a file's properties in Linux are its permissions. These permissions
describe who can do what to files and directories. The following permissions
are available:
Search WWH ::




Custom Search