Use the chown command to change user and group ownership of files and directories.
# To change the owner user of a file/folder: chown <user_name> <path/to/file> # To change the owner user and group of a file/folder: chown <user_name>:<group_name> <path/to/file> # To recursively change the owner of a folder and its contents: chown -R <user_name> <path/to/folder> # To change the owner of a symbolic link: chown -h <user_name> <path/to/symlink> # To change the owner of a file/folder to match a reference file: chown --reference=<path/to/reference_file> <path/to/file> # Mass change ownership, including files and directories with spaces. find . -uid 0 -print0 | xargs -0 chown foo:foo # uid 0 root user # foo:foo user:group to make owner and group. # . the current directory and below. # -print0, -0 indicate that filenames and directories are terminated by a null # character instead of by whitespace.