Skip to main content

Understanding about file/folder permission for Linux System

There are three types of access restrictions:


Permission Action Chmod Option
Read View r or 4
Write Edit w or 2
Execute Execute x or 1


There are also three types of user restrictions:


User ls Output
Owner -rwx------
Group ----rwx---
Other -------rwx

Understanding of Symbolic Notation:


Symbolic Notation Octal Notation Meaning
---------- 0000 No Permissions
---x--x--x 0111 Execute
--w--w--w- 0222 Write
--wx-wx-wx 0333 Write & Execute
-r--r--r-- 0444 Read
-r-xr-xr-x 0555 Read & Execute
-rw-rw-rw- 0666 Read & Write
-rwxrwxrwx 0777 Read, Write & Execute

Example:

If permission like 755,
  • 7 - rwx (Owner can read, write & execute)
  • 5 - r-x  (Group user can read & execute)
  • 5 - r-x  (Group user can read & execute)
On production server, this kind of permission is useful & secure.

For files:
  • sudo find ./ -type f -exec chmod 644 {} \;
For folders:
  • sudo find ./ -type d -exec chmod 755 {} \;

Comments

Popular posts from this blog

How to install & Unistall Node in Ubuntu ?

There are several steps for Uninstall/Remove node.js from Ubuntu 16.04.  Open terminal by  ctrl+alt+t  and run below commands            sudo apt-get purge nodejs            sudo apt-get purge --auto-remove nodejs            sudo apt-get autoremove Remove folder from home directory - .nvm, .node-gyp Remove global library folders using below commands            sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules            sudo rm -rf /usr/local/lib/node*            sudo rm -rf /usr/local/include/node*            sudo rm -rf /usr/local/bin/node*            sudo rm -rf  /usr/local/li...

How to create Virtual host for Laravel in Ubuntu 16.04 ?

Laravel Project Configuration & Create Virtual Host: Step 1: Create new laravel project with composer. php composer.phar create-project --prefer-dist laravel/laravel blog "5.5.*" Step 2: We can start the project using the "php artisan serve" command. But often we do not have to turn on the command, so we will set up a virtual host. Using sudo command open the below file. The file will be open as shown below. sudo nano /etc/hosts Step 3: Must add the domain name related to the project. 127.0.1.1          blog.local Step 4: We will create a file to attach the project to the domain in below folder. And save with such name "blog.conf". cd /etc/apache2/sites-available/ <VirtualHost *:80> ServerAdmin admin@admin.com ServerName blog.local ServerAlias blog.local DocumentRoot /var/www/html/blog/public/ <Directory /var/www/html/blog/public/> Options FollowSymLinks AllowOverride All Order allow,deny ...

How to create "Snippet" in Sublime 3 ?

There are few steps to create snippet in Sublime 3. Step-1: Open sublime and select menu.     Tools -> Developer -> New Snippet... Step-2: After select "New Snippet..." menu, below section will be display. Now, We will replace our snippet code with only 3 number line. Step-3: Here I have replaced sample snippet code for php script. Step-4: Write your short-code on line number 8. And now change on line number 10 I have write source.php for php script. If you want apply for other script language, you can set as per script. Step-5: Here is other snipplet example for javascript. Step-6: Save the file after all changes. Now, you can see "pre" snippet in suggested listing.