If you are not the owner of the file or directory, become superuser.
Only the current owner or superuser can use the chown command to change the owner of a file or directory.
Change the owner of a file by using the chown command.
$ chown newowner filename |
newowner |
Name of the new owner of the file or directory. |
filename |
File or directory. |
Verify the owner of the file is changed.
$ ls -l filename |
The following example sets the ownership on myfile to the user rimmer.
$ chown rimmer myfile $ ls -l myfile -rw-r--r-- 1 rimmer scifi 112640 May 24 10:49 myfile |