Permissions and Ownership

chown

Changes file owner and optionally group.

chown assigns ownership of files and directories. It is often used when files were created by root or need to belong to a service account.

Syntax
chown [options] owner[:group] file...

Arguments explained

  • owner is the target user.
  • group is optional after a colon.
  • -R applies recursively.

Common examples

Give a user a directory
sudo chown -R alex:alex /srv/app

Makes alex the owner and group for the app directory tree.

Change only owner
sudo chown www-data index.html

Sets the owner while leaving group unchanged.

chown Command
FieldDetails
Commandchown
CategoryPermissions and Ownership
Primary useChanges file owner and optionally group.
Syntaxchown [options] owner[:group] file...