Changing the Owner, Group, and Permissions
As we said, most of the time you can get by with the default security
the system gives you. But there are always exceptions,
particularly for system administrators. To take a simple example,
suppose you are creating a directory under /home for a
new user. You have to create everything as root, but when you’re
done you have to change the ownership to the user; otherwise, that
user won’t be able to use the files! (Fortunately, if you use the
adduser command discussed in
Section 5.7.5 in Chapter 5, it takes
care of ownership for you.)
Similarly, there are certain utilities such as UUCP and News that have their own users. No one ever logs in as UUCP or News, but those users and groups must exist so that the utilities can do their job in a secure manner. In general, the last step when installing software is usually to change the owner, group, and permissions as the documentation tells you to do.
The chown command changes the owner of a file, and the chgrp command changes the group. On Linux, only root can use chown for changing ownership of a file, but any user can change the group to another group he belongs to.
So after installing some
software named sampsoft, you might change both the owner and
the group to bin by executing:
#chown bin sampsoft#chgrp bin sampsoft
You could also do this in one step by using the dot notation:
# chown bin.bin sampsoftThe syntax for changing permissions is more complicated. The permissions can also be called ...