chmod – change file/folder permission in ubuntu

sample command:

 sudo chmod 754 /opt/lampp/htdoc

chmod command sets the permission of a file or folder. chmod command uses three digit code as an argument and the file or folder location.

In the example,

  • 7 – Owner(current user)
  • 5 – Group(set by owner)
  • 4 – anyone else

The fundamental concept:

Execute is 1, Write is 2 and Read is 4.

Sum of these basic ones makes combination of permissions:

  • 0 – no permission, this person cannot read, write or execute
  • 1 – execute only
  • 2 – write only
  • 3 – execute and write only (1 + 2)
  • 4 – read only
  • 5 – execute and read only (1 + 4)
  • 6 – write and read only (2 + 4)
  • 7 – execute, write and read (1 + 2 + 4)

source: online

About these ads

16 thoughts on “chmod – change file/folder permission in ubuntu

  1. Pingback: Amazon Elastic Computer Cloud (EC2) ตอน 9 : เซ็ต permission | select2web.com
  2. I’m having a problem. On Ubuntu 12.04, I really wanna get rid of a ton of cache files from Mozilla, they’re taking up over 10GB space. Every time I try to change the permissions, it tells me that its a read-only file system. the folder is /home/andyripper/.mozilla and I cannot change the permissions to read + write to save my life, I can’t do it through the properties window, and I can’t do it in the terminal either. I’ve tried chmod 757, and various other combinations and I keep getting:
    root@andyripper-4:/home/andyripper# sudo chmod 757 /home/andyripper/.mozilla
    chmod: changing permissions of `/home/andyripper/.mozilla’: Read-only file system

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s