Pages

Monday, February 27, 2012

CHANGING FILE PERMISSIONS

Changing the permissions can be done with names and numbers, I like the numbers

chmod 754  test.txt

Here is why:
4=read 2=write 1=execute.
The three numbers in the chmod above are for the

"user" ( the first number ),

"group" ( the second number ) and

"others" ( the third number )

So if I want to give the user all permissions: 4+2+1=7
and i give the group read an execute permissions: 4+1=5
and all others only read permission 4=4

chmod takes either the decimal representation of the permissions or a symbolic representation.

The symbolic representation is [ugoa][+-][rwx]. This is one of the letters

u  (user=file owner),

g  (group), o(others),

a   (all=u and g and o) followed by + or - to add or remove permissions and then the symbolic      representation of the permissions in the form of

r   (read)

w   (write)

x   (execute).

To make the file "file.txt" writable for all you type: "chmod a+w  file.txt"

No comments:

Post a Comment