Change ownership of File in Linux – Command chown

chown is used in Linux to change user ownership of a file, directory or link. The default owner of a file is user who has created the file. Only root can change ownership of file in Linux.

Change ownership of file in Linux with chown

First open terminal console and change to root user.

chown owner file

chown owner directory

chown -R owner directory

While first two commands can change owner of File/Directory. Third command can changes recursively i.e. ownership of entire contents of directory is changed.

To view user and group ownership of File or directory, in terminal mode type

ls –l  filename