Linux file permissions

Here are some tips on changing file permissions on a Linux file system

Basically these are the categories of identities

u This represents a user that owns the file

g This represents a group that users belong to

o This represents other identities (all identities other than the file in questions actual owner, or the group that owner belongs to)

a This represents all identities

These are the permissions

r Read Access

w Write access

x Executeable access

These are the add and remove operators

+ This adds permissions

– This removes permissions

= This sets exclusivety to the permission (only permission)

This is what a ll or ls -l looks like

type owner(u) group(g) others(o) fileSize ownership

-rw-rw-r– 128 root root

This is the basic syntax for changing permissions of a file

chmod identity operator permission filename

eg chmod a+x file.txt (gives executable access for all identities to the file.txt)

To chmod on whole directories recursively

use -R between chmod command and identity

eg chmod -R a+x file.txt

This can all be done using numbers instead of permissions (rwx etc)

r is equal to the number 4

w is equal to the number 2

x is equal to the number 1

– is equal to the number 0

eg to give read and write access you would add 4 + 2 giving 6

so to give all users read and write access chmod 666 filename.txt


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s