Basic Linux Tutorial
Computer Tutorial

Changing Owners and Groups



Changing Owners and Groups

While creating an account on Linux / Unix, it assigns a owner ID and a group ID to each user. All the permissions mentioned above are also assigned based on the Owner and the Groups.
Two commands are available to change the owner and the group of files −
1. chown
2. chgrp

» chown
The chown command stands for "change owner" and is used to change the owner of a file.
Syntex :
chown   user   filelist
The value of the user can be either the name of a user on the system or the user id (uid) of a user on the system.
Example :
chown   general   generalnote
It can Changes the owner of the given file to the user general.
NOTE − The super user, root, has the unrestricted capability to change the ownership of any file but normal users can change the ownership of only those files that they own.

Changing Group Ownership

» chgrp
The chgrp command changes the group ownership of a file. The basic syntax is as follows
Syntex :
chgrp   group   filelist
The value of group can be the name of a group on the system or the group ID (GID) of a group on the system.
Example :
chgrp   general   generalnote
It can Changes the group of the given file to group general.