Chmod

Salut, j'aimerais mieux comprendre le principe de modification des droits d'accès aux fichiers...

rwx rw- r-x correspond à
111 110 101... d'accord, mais pourquoi
c'est également = 765 ?

Merci de bien m'expliquer la signification de ce nombre octal.
A+

5 answers

  1. It's simple, I also had a hard time at the beginning, but it’s easy to understand...
    The first group of 3 letters corresponds to the hundreds,
    the second group of 3 letters corresponds to the tens,
    the third group of 3 letters corresponds to the units,
    r=4, w=2, x=1, -=0

    So for your example: rwx rw- r-x
    rwx =4+2+1=7
    rw- =4+2+0=6
    r-x =4+0+1=5
    hence 765
    There you go, it just took a little example...
    (@_@)
    0
    1. Contributor
      Hello,
      Depending on the versions of OS, there is still another way to change permissions:
      chmod [who] [permission] [operation]

      [who] is a combination of:
      u for user
      g for group
      o for other
      a for all
      [permission] is:
      + to allow
      - to deny
      = to assign certain permissions and remove others
      [operation] is a combination of:
      r for read
      w for write
      x for execute

      There you go...
      a +
        (:•Þ   Pitu
      Save my hammock, Eat Beaver!
      0
      1. Webmaster
        Hello,

        In order:
        User, Group, Other

        The user who owns the file, the group to which the file belongs, all the other users...

        567 makes no sense, r-x, rw-, rwx means that all users have full rights on the file in general, it’s more like rwx, r-x, r-x which is 755
        The user has full rights, others can only read or execute (listed in the case of a directory)

        "If it’s stupid and it works, then it’s not stupid."
        0
        1. ok I understood about octal numbers.
          But if you have a simple explanation of chmod and especially
          the choice of numbers for access.
          for example: why chmod 567 toto and why not chmod 765 toto?
          thank you
          0