Section 3.31. Changing a File s Owner: chown


[Page 76 (continued)]

3.31. Changing a File's Owner: chown

If for some reason you ever want to relinquish ownership of a file, you may do so by using the chown utility (Figure 3-43).

Figure 3-43. Description of the chmod command.

Utility: chown -R newUserId { fileName }+

The chown utility allows a super-user to change the ownership of files. All of the files that follow the newUserId argument are affected. The -R option recursively changes the owner of the files in directories.


Linux allows only a super-user to change the ownership of a file. Several occasions when the system administrator needs to use chown are described in Chapter 14, "System Administration."

If I had been a super-user, I could have executed the following sequence of commands to change the ownership of "heart.final" to "tim" and then back to "glass" again:

# ls -l heart.final            ...before. -rw-r-----  1  glass  music 213  Jan 31 00:12 heart.final # chown tim heart.final        ...change the owner to "tim". # ls -l heart.final            ...after. -rw-r-----  1  tim    music 213  Jan 31 00:12 heart.final # chown glass heart.final      ...change the owner back. # _ 





Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net