You are on page 1of 5

Chmod :

Linux has inherited from UNIX the concept of ownerships and permissions for files. This is basically
because it was conceived as a networked system where different people would be using a variety of
programs, files, etc. Obviously, there's a need to keep things organized and secure. We don't want an
ordinary user using a program that could potentially trash the whole system. There are security and
privacy issues here as well.
The big advantage that Linux has is its multi-user concept- the fact that many different people can use
the same computer or that one person can use the same computer to do different jobs. That's where
the system of file permissions comes in to help out in what could be a very confusing situation.
Following are the symbolic representation of three different roles:
u is for user(owner),
g is for group,
and o is for others.
S The set-user-ID-on-execution and set-group-ID-on-execution bits.
t The sticky bit.

Following are the symbolic representation of three different permissions:
r is for read permission,
w is for write permission,
x is for execute permission.
Three file permissions:
read: permitted to read the contents of file.
write: permitted to write to the file.
execute: permitted to execute the file as a program/script.
Three directory permissions:
read: permitted to read the contents of directory ( view files and sub-directories in that directory).
write: permitted to write in to the directory. ( create files and sub-directories in that directory )
execute: permitted to enter into that directory.
Numeric values for the read, write and execute permissions:
read 4
write 2
execute 1
To have combination of permissions, add required numbers. For example, for read and write permission,
it is 4+2 = 6.
Changing the file permissions by using numeric values
Modes may be absolute or symbolic. An absolute mode is an octal number
constructed from the sum of one or more of the following values:
4000 : (the setuid bit).
Executable files with this bit set will run with effective uid set to the uid of the file owner. Directories
with this bit set will force all files and sub- directories created in them to be owned by the directory
owner and not by the uid of the creating process
2000 : (the setgid bit).
Executable files with this bit set will run with effective gid set to the gid of the file owner.
1000 : (the sticky bit).
1. Add single permission to a file/directory
Changing permission to a single set. + symbol means adding permission. For example, do the following
to give execute permission for the user irrespective of anything else:
$ chmod u+x filename
2. Add multiple permission to a file/directory
Use comma to separate the multiple permission sets as shown below.
$ chmod u+r,g+x filename
3. Remove permission from a file/directory
Following example removes read and write permission for the user.
$ chmod u-rx filename
4. Change permission for all roles on a file/directory
Following example assigns execute privilege to user, group and others (basically anybody can execute
this file).
$ chmod a+x filename
5. Make permission for a file same as another file (using reference)

If you want to change a file permission same as another file, use the reference option as shown below.
In this example, file2s permission will be set exactly same as file1s permission.

$ chmod --reference=file1 file2
6. Apply the permission to all the files under a directory recursively

Use option -R to change the permission recursively as shown below.

$ chmod -R 755 directory-name/
7. Change execute permission only on the directories (files are not affected)

On a particular directory if you have multiple sub-directories and files, the following command will
assign execute permission only to all the sub-directories in the current directory (not the files in the
current directory).

$ chmod u+X *
Note: If the files has execute permission already for either the group or others, the above command will
assign the execute permission to the user


The flow of steps when we power on our OS (Linux):

Linux

Power On

POST(Post Power Self Test)----->Electric signals------->vital
components (CPU,Memory,I/o Controllers)

Bios(Basic i/o System)


CD-ROM Hard Drive


1 st Sector contains(MBR)

MBR(Master Boot Record) size: 512 bytes
IPL(the initial boot loader) it
contains (Boot Loader)Linux(or)
GRUB(Grand Unified Boot Loader)
Size: 446 bytes)
PTI(Partition Table info)
Size:64 bytes



We can make only four partitions on hard disk .For each partition the PIT consumes 16 bytes
The four partitions are
1)/(root)
2)/boot Primary Partitions
3)swap
4)Extended Partition
Now we can make extended partitions in to 12 logical partitions on hard disk
Command used to make logical partitions is #fdisk /deb/sda
p -(to print partitions)
n (to make new partition )
w (to save new partitions and quit from fdisk)
q (to quit with out saving changes in hard disk)
d- (to delete the partitions )
Note: Dont delete the primary partitions at any cost why because OS lost its functionality
After making changes in hard disk re boot the system
For re booting the system the command is:
#reboot (to restart the system )
To check the hard disk partitions the command is
#fdisk l (or) #parted -l