CHMOD- Permissions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sajithamol

    CHMOD- Permissions

    In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.
  • skyy
    New Member
    • May 2007
    • 109

    #2
    Originally posted by sajithamol
    In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.

    Hi..

    Are u sure google doesnt explain?

    Anyway a file's permission is group into user-group-others
    For each file there is read(r) write(w) and executable(x) permission for each group. To turn on the permission, u just have to set it to '1'. Hence a 777 will allow all user(user-group-others) all the permission.

    A digit '7' is represent by "111" in binary. which specifies the permission for read(r) write(w) and executable(x).

    hope that helps...

    Comment

    • devikacs
      New Member
      • Jun 2007
      • 96

      #3
      hi

      I would not suggest you to use 777 anytime. Any file with 777 permission can be accessed, modified or deleted by anyone.

      Permissions are given as owner-group and others. For each of the 3 above, you can set on or off, read, write and executable permissions.
      [owner]rwx[group]rwx[others]rwx
      can be specified using its binary code, r=1 means read permission is set.
      So it you set 755, you are allowing to read, write and execute and any others can only read or execute. [101 is 5].

      For a file, read and write permissions are self-explanatory. Execute permission is needed only when you have an executable file. scripts,etc

      For a directory, read permission allows you to enter the directory. Execute permission lets you to list the files, and write permission is needed to create or delete any file in the directory

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        Originally posted by sajithamol
        In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.
        Here is the easiest way that I know of, to explain the number based permissions in *nix.

        The permissions look like this:

        rwx rwx rwx

        This is noticably broken down into 3 groups. The first group, on the left, is Owner, the middle group is...well.....G roup, and the group on the right is User.

        If you think of them as numbers, then it would look like this:

        421 421 421

        Where "4" stands for read, "2" stands for write and "1" stands for execute.

        Lets say you want permissions of "rw- rw- rw-", you would convert that to numbers as such: "42- 42- 42-", then, add each group up to obtain the number: 666.

        So, to set permissions of rw- rw- rw-, you would need to do a "chmod 666 file".

        I hope this helps as I know this has helped others that I have explained it to.

        Regards,

        Jeff

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          I have a link for you.

          Comment

          Working...