Ownership Permissions¶
In addition to modifying permissions on files, you can also modify the group and user ownership of the file as well.
Modify user ownership
This command will set the owner of myfile
to staff.
Modify group ownership
This command will set the group of myfile
to whales.
Modify both user and group ownership at the same time
If you add a colon and groupname after the user, you can set both the user and group at the same time.
Exercise¶
Modify the group and user of some test files. Afterwards, take a look at the permissions with ls -l
.
Interactive Quiz¶
1. What command do you use to change user ownership?
2. Which command changes the group ownership of a file?
3. What command would you use to change both the user and group ownership of a file in one command?
Summary¶
- The
chown
command is used to change the user ownership of a file. - The
chgrp
command is used to change the group ownership of a file. - Both user and group ownership can be changed simultaneously using
chown user:group
.