Commands · Command

CommandLinuxmacOS

chown

chown [options] owner[:group] file

Changes which user (and optionally group) owns a file or directory.

// FLAGS

-Rrecursive
-vverbose

// EXAMPLE

chown -R www-data:www-data /var/www/html — hands over an entire web directory to the web server's user and group.

// GOTCHA

Requires root/sudo to change ownership to a different user — a common error is forgetting sudo and getting a silent "Operation not permitted."

// RELATED COMMANDS