Each file is owned by a particular user.

When a file is created, it belongs to the user who created it. For example, if I created a new file:

    % ls hello.out
    hello.out not found
    % echo "Hello" > hello.out
    % ls hello.out
    hello.out

The new file belongs to me. I can confirm this by running the ls -l command. Among other things, this command tells me who owns the file:

    % ls -l hello.out
    -rw-r---- 1 lmui 6 Nov 16 10:46 hello.out

The part to pay attention to is that the third field in the listing reads “lmui,” which is my login name. This tells me and anyone else that the hello.out file belongs to me.

This matters for the following reasons:

  • The permissions on the file are initially set by the owner’s environment

  • Only the owner of the file and the superuser can change the permissions on the file

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.