Introduction
In Unix-type systems, each file and directory has an associated owner and group. The commandchownThis is essential for the management of permits and security.
Basic syntax
The simplest way ofchownis:
chown [opciones] usuario[:grupo] archivo
Whereusuariois the new owner andgrupo(optional) the new group. If the group is omitted, only the owner is changed.
Most commonly used options
-Ror--recursive: applies the change recursively to all files and subdirectories within a directory.-vor--verbose: shows detailed information on each processed file.-cor--changes: reports only when a change occurs.--reference=ARCHIVO: copy the owner and group of another reference file.
Practical examples
Change the owner of a single file
chown juan documento.txt
Change owner and group
chown juan:developers proyecto/
Recursive operation with detailed output
chown -Rv juan:developers /home/juan/proyecto
Use a reference file
chown --reference=plantilla.txt nuevo.txt
Good practices and precautions
- Always check the route before running
chown -Rto avoid accidentally changing the property of critical directories such as/etcor/var. - Use the mode
--verboseor--changesto observe what is modified. - In production systems, try first in a test directory or use
sudoonly when necessary. - Remember that changing the system's file owner can affect services and permissions; check the application documentation if you have doubts.
Conclusion
The commandchownis a key tool for any Linux administrator. Knowing your syntax, options and risks allows you to manage file ownership safely and efficiently. Practice in a controlled environment and apply the examples shown here to gain confidence in their daily use.


