Every Linux filesystem object records a user owner and a group owner. These identities determine which owner or group permission triplet applies, but they do not themselves grant a particular permission. Inspect both ownership and mode with ls -l.
Permissions · Lesson 3
Ownership Permissions
Learn how to inspect and change the user and group ownership of Linux filesystem objects.
Changing the User Owner
Use chown, short for change owner, to assign a different user owner:
$ sudo chown patty myfile
This changes the user owner of myfile to patty and leaves its group unchanged. Changing a file's user owner normally requires appropriate privilege, even if you currently own the file. This restriction prevents users from transferring files to evade quotas or other ownership-based controls.
Which command changes the user owner of myfile to patty while leaving its group unchanged?
Changing the Group Owner
Use chgrp to assign a different group owner:
$ chgrp whales myfile
On typical systems, an unprivileged owner can change a file's group only to a group of which that user is a member. Privileged processes can make broader changes. The equivalent chown form begins with a colon:
$ chown :whales myfile
Afterward, the group's mode bits apply when the kernel selects the group class; changing the group does not automatically add read, write, or execute bits.
What does chgrp whales myfile change?
Changing User and Group Together
Supply USER:GROUP to chown to update both fields in one operation:
$ sudo chown patty:whales myfile
The command assigns patty as the user owner and whales as the group owner. Verify the result rather than assuming it succeeded:
$ ls -l myfile
Which ownership specification assigns user patty and group whales in one chown command?
Handling Recursive Changes Carefully
The -R option changes ownership recursively, but a broad recursive command can cross unexpected directory trees or affect service data. Confirm the exact target, understand symbolic-link behavior for your implementation, preview the tree, and verify a small sample before changing a large hierarchy. Avoid copying privileged ownership commands from examples onto real systems without reviewing their scope.
After changing a file's group owner, what happens to its ordinary group permission bits?
For practice in an isolated environment, the Linux User Group and File Permissions lab covers inspecting and modifying ownership alongside file modes.
Lesson complete
You finished Ownership Permissions
You can now distinguish ownership metadata from permission bits and change it deliberately.
Use
chown USER FILEto change the user owner.Use
chgrp GROUP FILEorchown :GROUP FILEto change the group owner.Use
chown USER:GROUP FILEto set both fields.Verify results and scope recursive changes carefully.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account