Find the answer to your Linux question:
Results 1 to 4 of 4
In the past, I have typed in a terminal: chmod 777 filepath and it changed the permissions of all the files and subdirectories. However, I have also learned that the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User SkittleLinux18's Avatar
    Join Date
    Dec 2007
    Location
    Mesa, AZ
    Posts
    312

    [SOLVED] Question regarding CHMOD terminal command...


    In the past, I have typed in a terminal:

    chmod 777 filepath
    and it changed the permissions of all the files and subdirectories. However, I have also learned that the only way to change the permissions of all the subdirectories is to type in a terminal:

    chmod --r 777 filepath
    I guess my question is, what's the difference if they both do the same thing?
    Linux user since: June 2007
    Current distro: kubuntu-14.04
    Specs: AMD Atholon 64 X2 3.2 Ghz, 4GB RAM, GeForce GTS 250 1GB VRAM
    High five if you saw the linux computers 24 used on their CTU sets.

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    It shouldn't do that.
    chmod should not recurse unless called with -R (uppercase!).

    If it does, I assume your distributor made a macro called by that name which is mapped to chmod with the recursive option.

    Try to call explicitly /bin/chmod and see if it is any different.
    Debian GNU/Linux -- You know you want it.

  3. #3
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,049
    Quote Originally Posted by SkittleLinux18
    In the past, I have typed in a terminal:
    Code:
    chmod 777 filepath
    and it changed the permissions of all the files and subdirectories.
    I certainly hope not

    Calling `chmod 777 /path/to/file` should only change permissions on 'file' in '/path/to/' and not anything else. You can make it recursive with the -R option, yes, if that is your intent. But it shouldn't be default. That might just make your entire collection of nature pictures world readable.
    Can't tell an OS by it's GUI

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User SkittleLinux18's Avatar
    Join Date
    Dec 2007
    Location
    Mesa, AZ
    Posts
    312
    Quote Originally Posted by GNU-Fan View Post
    It shouldn't do that.
    chmod should not recurse unless called with -R (uppercase!).

    If it does, I assume your distributor made a macro called by that name which is mapped to chmod with the recursive option.

    Try to call explicitly /bin/chmod and see if it is any different.
    I pulled up the help menu for chmod in the terminal, and --R was definitely listed as an option in there. I must have typed --R in the past and, for some freakish reason, just can't remember. Thanks, guys.
    Linux user since: June 2007
    Current distro: kubuntu-14.04
    Specs: AMD Atholon 64 X2 3.2 Ghz, 4GB RAM, GeForce GTS 250 1GB VRAM
    High five if you saw the linux computers 24 used on their CTU sets.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •