Posts Tagged ‘ permission ’

Setting File and Folder Ownership
 
Every file or folder belongs to an owner and a group
To change ownership use the syntax:
~# chown username:usergroup filename
~# chown username:usergroup foldername
To change ownership recursively, meanwhile all files inside a folder:
~# chown -R username:usergroup foldername
To check and visualize your changes type:
~# ls -hal

 

Setting File and Folder Permissions
 
Permission are represented by a 3 digit numerical code
First Digit: Owner
Second Digit: Group
Third Digit: Everybody

Permission 0 = no access
Permission 4 = read
Permission 6 = read / write
Permission 5 = read / execute
Permission 7 = read / write / execute

To set permissions use syntax
~# chmod 644 filename
Setting filename to read/write (owner) and read (group and world)
To set permissions recursively for all files inside a folder use
~# chmod -r 755 foldername
Setting foldername and all files inside to raed/write/execute (owner) and read/execute ( group and world )

You can restrict your settings and give permissions only for specified files
~# chmod 644 *.php
Setting all php files inside this folder to read/write – read – read