Chown Calculator

Build a chown command to change file or directory ownership: owner, group, recursive, and safety flags like --from.

Free Runs in your browser

Leave empty to change only the owner. A leading colon with no owner (e.g. :group) changes only the group.

Options

sudo chown www-data:www-data /var/www/html

Common patterns

How to use

  1. 1 Enter an owner, a group, or both. Leave one blank to change only the other.
  2. 2 Enter the path to the file or directory, and toggle -R to apply recursively.
  3. 3 Toggle sudo, -v, or --from as needed, or click a common pattern to fill the form.
  4. 4 Copy the generated chown command and run it on your server.

Key features

  • Builds a chown command from owner, group, and path; either can be left blank
  • Toggles for -R (recursive), -v (verbose), sudo, and --from (safety check)
  • One-click patterns for common cases: web server, project directory, group-only
  • Copies the ready-to-run command for direct use in terminal

What does chown do?

chown changes who owns a file or directory: the user and the group. That's different from chmod, which changes what the owner, group, and others are allowed to do. A file can be perfectly readable and writable (666) and still cause "Permission denied" if it's owned by the wrong user.

The syntax is chown OWNER:GROUP FILE. Omit the group (chown OWNER FILE) to change only the owner and leave the group as-is. Start with a colon and no owner (chown :GROUP FILE) to change only the group. Changing a file's owner to someone else normally requires root. A regular user can't give a file away.

Common Use Cases

Fixing web server permission errors

Nginx or Apache running as www-data can't serve files it doesn't own or belong to. chown www-data:www-data on the web root is the standard fix.

Handing files back after a root operation

A file created by a root-run script or a Docker container often ends up owned by root. chown it back to your own user to edit it normally.

Setting up a shared project directory

Recursively set a directory to a shared group so every teammate can write to it, instead of chasing permission errors file by file.

Debugging "Permission denied" that chmod can't fix

If the permission bits already look right, the file is probably owned by the wrong user or group. Check with ls -l before reaching for chmod.

Restoring ownership after a backup restore

Archive tools often extract files as the current user (frequently root). --reference or an explicit chown -R puts ownership back where it belongs.

Docker volumes and bind mounts

A container process running as a non-root UID needs the host directory it writes to chowned to that same UID, or writes fail silently.

Flags This Tool Uses

chown has more flags than this, but these are the ones you'll actually reach for.

FlagMeaning
-RRecursive: apply to a directory and everything inside it
-vVerbose: print a line for every file processed, useful in scripts
--from=OWNER:GROUPOnly change ownership if the current owner and group match this value, a safety check for scripted, recursive changes
sudoNeeded whenever you hand a file to a different user; only root can do that