Files permissions


When you try to run a file it may refuse to work with an error like “Permission denied” and when you try to
view another file it may also say that you don’t have permission to view it. These all come down to file
permissions, a basic feature of Unix.

There are 3 types of permissions: read, write and execute. When you list files it will say which permission the
files have:
ls -l file.dat
-rw-r–r– 1 root users 1656 Mar 22 00:27 file.dat

The first part of that line is the permissions. They are, in order, the user permissions, the group permissions
and others permissions, where r means read, w means write and x means execute. For this file, the user, root,
has read and write permission (rw-), the group, users, can only read the file (r–) and everyone else can also
only read the file (r–).

Other letters may appear. The first letter is – for a normal file, d for a directory and c or b for a device. In
place of x you may see a letter s. This means that when you start a program, it will run as its owner.

Leave a Reply

Your email address will not be published. Required fields are marked *