Important Concepts For Linux Beginners - Permissions And Groups

The easiest way to learn Linux permissions islaunched.
from an example. The ls -l command generates aLinux defines permissions for directories that are
list of contents, such as files along with theirsimilar to but not exactly the same as the file
permissions. Let's take a look at the defaultpermissions. A read permission on a directory
values for a file called Filename. We are addingmeans that its contents may be listed. A write
spaces to make the output more legible.permission on a directory means that the user
- rw- r-- r-- other information about the filecan modify its contents, by adding, deleting, or
Filenamerenaming files. An execute permission on a
The initial - signifies that this is a file (not adirectory means that it may be accessed, in
directory). The next three characters refer to theother words made the current working directory.
file permissions for the file owner, in many casesPermissions may be changed via the chmod
the person who created the file. The values rw-command as in the example chmod 770 Junque
signify that the owner has read and writewhich gives read, write, and execute permissions
(modify) permission but not execute permission.to the file owner and members of the ownership
Had these values been r-x the owner would begroup but no permissions to anyone else. Not
able to read and execute the file (program) buteveryone likes working with these numbers. The
not modify it. The second set of values r-- signifysymbolic mode uses letters and the plus and
that the members of the group associated withminus signs to change permissions.
this file have read but not write or executeThe following command removes the write
permission. The third set of values also r-- signifypermission from the user (owner) of the Perm file
that other users have read but not write orchmod u-w Perm. To add the execute permission
execute permission.for others, people who do not belong to the
Permissions are often handled numerically. The rgroup that owns the file apply the command
has a value of 4, the w has a value of 2, and thechmod o+x Perm This command only makes
x has a value of 1. In all cases the lack ofsense if the Perm file is executable. Furthermore,
permission has the value 0. So rw- has the valueunder most circumstances the file owner and his
6 and r-- has the value 4. In the above exampleor her group will have more permissions that the
the permissions may be expressed as 644. Theothers. Linux doesn't always check to see that
full set of permissions for everyone is expressedyour command really makes sense. Do you think
as 777 (not usually a good idea).that Windows is more intelligent in this respect?
Note that the root user's permissions aren't listed.The chown command is used to change the
This shouldn't be surprising because root hasownership of a file or a directory. The chgrp
essentially complete permissions. But even root'scommand is used to change the group ownership
doesn't have execute permissions for a file itof files and directories. These commands might
creates. This permission must be added in abe used when a project passes from the
separate step. Why? This two-step procedure hasdevelopment to the testing stage. Needless to
important security implications. Let's say thatsay only the system administrator can execute
someone, perhaps root, has received an emailthese commands.
that contains a virus-infested executable program.Of course there is more to Linux permissions and
The program cannot be executed without thegroups but we have covered the basics. The next
explicit permission of root or the recipient. If thearticle in this series discusses inodes, a topic that
user doesn't know what to do the virus won't beis sorely missing from the Windows bag of tricks.