Masters of Computer Science Open Source Technology

File permission, changing permission and ownership in Linux

File permission, changing permission and ownership in Linux

Linux Authorization

For security purpose, LINUX divides authorization in

  • Ownership
  • Permission


  • In linux, every file and directory is assigned with 3 tyoes of owner
    • User
      • Owner of the file
      • Who creates a file is owner by default
      • Its owner of the file
    • Group
      • Has multiple users
      • All users in a group has same permission to access the file
      • If you assigned permission to group, no one else can read except group members
    • Other
      • Other users other than users and group
      • Everybody else
      • This user hasn’t created file and doesn’t belong to any group


  • In linux, every file can be assigned with 3 permissions
    • Read
      • Has authority to open and read file
      • Content of directory can be listed
    • Write
      • Access to modify content
      • Adding, removal of content
      • File can be renamed
    • Execute
      • .exe in windows, which can run
      • To run program, execute permission is needed


Is –l on linux terminal gives

Here, rwxrwxrwx code tells about the permission that are given owner, group and world

Character means,

r = read

w = write

x = execute

-= no permission

Let us see


which means for the user in file / folder can

  • Read file
  • Write or edit the file
  • Can’t execute as permission is set –

First part is for user, second for group and third for world.

Changing file/directory permission

  • We can use chmod command
  • Chmod stands for changemode
  • Permission (read, write, execute) can be set with this command
  • Syntax: chmod permission filename

Chmod command can be used in two ways

Absolute mode

  • Here, permission are represented as three digit octal number
0No Permission
3Execute + Write-wx
5Read + Executer-x
6Read +Writerw-
7Read + Write +Executerwx
  • Example : chmod 777 filename
    • 777 represents read write and execute permission for user, groud and others all
  • Chmod 707
    • 707 represents user have read write and execute permission, group has no permission and others have read write and execute permission.

Symbolic Mode

  • In absolute, we change permission for all 3 owners
  • In symbolic, permission can be modified for specific owner
  • Mathematical symbol is used
+Adds a permission to a file or directory
Removes the permission
=Sets the permission and overrides the permissions set earlier.

Users are represented as






Chmod o=rwx examplefile

This is setting permission tp others

Chmod g-r test

This is removing read permission for group from file test

Changing ownership and group

  • To changeownership, chown command is used
  • Chown user

If you want to change the user and group for a file

Chown user:group filename

If you want to change group owner only

Chgroup group-name filename

Chgrp stands for change group

About Author

ICT Byte