File And Folder Permissions - Chmod on Linux, Centos, Ubunto

Sunday, February 2, 2014

File And Folder Permissions - Chmod on Linux, Centos, Ubunto, Fedora

 file & folder have methods of assigning permissions or access rights to specific users and groups of users. These file systems control the ability of the users to check or make changes to the contents of the filesystem on linux, centos, ubunto, fedora etc operationg system.

Want to check a permission of file/folder need to use below command :-
> ls -al
command result is :-
>-rw-r--r--  1  bob  users  1892  Jul 10  18:30 linux_course_notes.txt

Chmod Command :-
chmod is a Linux command that will let you \"set permissions\" (aka, assign who can read/write/execute) on a file.

> chmod permissions file
> chmod permission1_permission2_permission3 file

When using chmod, you need to be aware that there are three types of Linux users that you are setting permissions for. These users are technically know as:-
1. Owner
2. Group
3. World

There are three types of permissions that Linux allows for each file.
1. read
2. write
3. execute


if you wanted a file to be readable by everyone, and writable by only you, you would write the chmod command with the following structure.

COMMAND : OWNER : GROUP : WORLD : PATH

chmod read & write read read FileName

chmod 644 myfile.txt

ls -al

-rw-r--r-- 1 gcawood iqnection 382 Jan 19 6:49 myfile.txt

You will need to convert the word read or write or execute into the numeric equivalent (octal) based on the table below.

4 read (r)
2 write (w)
1 execute (x)

Permission Examples
chmod 400 mydoc.txt read by owner
chmod 040 mydoc.txt read by group
chmod 004 mydoc.txt read by anybody (other)
chmod 200 mydoc.txt write by owner
chmod 020 mydoc.txt write by group
chmod 002 mydoc.txt write by anybody
chmod 100 mydoc.txt execute by owner
chmod 010 mydoc.txt execute by group
chmod 001 mydoc.txt execute by anybody

7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)

Notation of traditional Unix permissions:-

Symbolic notation:-
Each of the three characters represent the read, write, and execute permissions:
* r if reading is permitted, - if it is not.
* w if writing is permitted, - if it is not.
* x if execution is permitted, - if it is not.

The following are some examples of symbolic notation:
* -rwxr-xr-x a regular file whose user class has full permissions and whose group and others classes have only the read and execute permissions.
* crw-rw-r-- a character special file whose user and group classes have the read and write permissions and whose others class has only the read permission.
* dr-x------ a directory whose user class has read and execute permissions and whose group and others classes have no permissions.

Numeric notation:-
Each of these digits is the sum of its component bits (see also Binary numeral system). As a result, specific bits add to the sum as it is represented by a numeral:
1. The read bit adds 4 to its total (in binary 100),
2. The write bit adds 2 to its total (in binary 010), and
3. The execute bit adds 1 to its total (in binary 001).

Symbolic NotationOctal NotationEnglish
----------0000no permissions
---x--x--x0111execute
--w--w--w-0222write
--wx-wx-wx0333write & execute
-r--r--r--0444read
-r-xr-xr-x0555read & execute
-rw-rw-rw-0666read & write
-rwxrwxrwx0777read, write, & execute

Special Permissions for Files :- 
Control
Full Modify
Execute
Read & Read
Write
Special Permissions
Traverse Folder/Execute File
X
X
X


List Folder/Read Data
X
X
X
X

Read Attributes
X
X
X
X

Read Extended Attributes
X
X
X
X

Create Files/Write Data
X
X


X
Create Folders/Append Data
X
X


X
Write Attributes
X
X


X
Write Extended Attributes
X
X


X
Delete Subfolders and Files
X




Delete
X
X



Read Permissions
X
X
X
X
X
Change Permissions
X




Take Ownership
X







Special Permissions for Folders:-

Full Modify
Execute
Read & Contents
Folder Read
List Write
Special Permissions
Control
Traverse Folder /
X
X
X
X


Execute File






List Folder /Read Data
X
X
X
X
X

Read Attributes
X
X
X
X
X

Read Extended
X
X
X
X
X

Attributes






Create Files /
X
X



X
Write Data






Create Folders /
X
X



X
Append Data






Write Attributes
X
X



X
Write Extended
X
X



X
Attributes






Delete Subfolders
X





and Files






Delete
X
X




Read Permissions
X
X
X
X
X
X
Change Permissions
X





Take Ownership
X







Read more...

How to Install Bugzilla on CentOS

How to Install Bugzilla on CentOS

there are following steps to configure Bugzilla on CentOS step by steps.

1. Install required packages :-
    >yum install perl* httpd* mysql-server* mod_perl-devel -y

2. Download the latest bugzilla 4.4.2 :-
  > cd /var/www/html
  > wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.4.tar.gz
  > tar zxvf bugzilla-4.4.2.tar.gz
  > mv bugzilla-4.4.2 bugzilla

3. Start mysql server :-
  > service mysqld start

4. Set mysql root password via mysql_secure_installation :-
  > sudo /usr/bin/mysql_secure_installation

5. Create a DB for bugzilla mysql login with root :-
  > mysql -u root -p
  mysql> CREATE DATABASE bugs ;
  mysql> exit

6. Run checksetup script to find needed modules :-
  > ./checksetup.pl

7. Install required modules :-
  > /usr/bin/perl install-module.pl ––all

8. Run checksetup script again to generate localconfig file :-
   > ./checksetup.pl

9. Modify localconfig  for  $db_name, $db_user and $db_pass based on previous settings :-
  > vi ./localconfig

10. Run checksetup script to set initial configuration :-
   > ./checksetup.pl

11. Apache setup, modify httpd.conf, append the following config :-
   > vi /etc/httpd/conf/httpd.conf
   add bellow lines in httpd.conf

 
    AddHandler cgi-script .cgi
   Options +Indexes +ExecCGI
   DirectoryIndex index.cgi
   AllowOverride Limit FileInfo Indexes
 

 OR

 
        DocumentRoot /var/www/html/bugzilla
        ServerAlias bugzilla.yourdomain.com
        AddHandler cgi-script .cgi
        Options +Indexes +ExecCGI
        DirectoryIndex index.cgi
        #AllowOverride Options Limit
        #AllowOverride Limit FileInfo Indexes



12. Restart Apache :-
   > service httpd restart

13. Chkconfig httpd and mysql :-
   > chkconfig httpd on

   > chkconfig mysqld on

14. Set iptables for httpd :-
   > iptables -I INPUT -p tcp ––dport 80 -j ACCEPT

15: check in browser :-
    Open http://localhost/bugzilla





Read more...

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP