Results 1 to 3 of 3

Thread: permissions for directories and files

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    4

    permissions for directories and files

    I have a directory that has both files and directories within it. The permissions for this directory, and all it's recursive contents, are set to 755. I want to recursively set all the permissions for all the files to 644 (-rw-r--r--) and all the directories to 744 (drwxr--r--). How can I do this without editing the files individually? If I do chmod -R 744 ./files/ then the directories will open fine, but the files will have the execute bit set. But if I do 'chmod -R 644 ./files/' all the files will be nonexecutable like i want, but the directories won't open (they need the executable bit). How can I recursively change permissions for files and directories separately? I have read all the chmod and chown docs I can find, and there is no mention of this problem. Any and all help is greatly appreciated.

  2. #2
    Senior Member registered user
    Join Date
    Nov 2002
    Location
    USA, IL
    Posts
    1,041

    Re: permissions for directories and files

    Try this: Set things to 644 first, then:
    Code:
    cd your-directory
    chmod -cvR 644 .
    find . -type d -exec chmod -cv 744 '{}' \;
    --The goofy-looking syntax is to escape the "find" parameters so the shell doesn't try to deal with them.

    Quote Originally Posted by mikji
    I have a directory that has both files and directories within it. The permissions for this directory, and all it's recursive contents, are set to 755. I want to recursively set all the permissions for all the files to 644 (-rw-r--r--) and all the directories to 744 (drwxr--r--). How can I do this without editing the files individually? If I do chmod -R 744 ./files/ then the directories will open fine, but the files will have the execute bit set. But if I do 'chmod -R 644 ./files/' all the files will be nonexecutable like i want, but the directories won't open (they need the executable bit). How can I recursively change permissions for files and directories separately? I have read all the chmod and chown docs I can find, and there is no mention of this problem. Any and all help is greatly appreciated.

  3. #3
    Junior Member
    Join Date
    Oct 2003
    Posts
    4
    That is exactly what I was looking for! Many thanks Dave.

Similar Threads

  1. locked files/ unable get permissions
    By finder in forum General Support
    Replies: 1
    Last Post: 04-13-2005, 03:40 PM
  2. Replies: 0
    Last Post: 04-13-2005, 01:30 AM
  3. Need help with directories & files
    By Ezor in forum General Support
    Replies: 2
    Last Post: 01-04-2005, 07:26 PM
  4. KDE permissions and user permissions!!!
    By newiaqua in forum Hdd Install / Debian / Apt
    Replies: 4
    Last Post: 12-26-2004, 07:49 PM
  5. Directories that need RW
    By davidc in forum Customising & Remastering
    Replies: 0
    Last Post: 04-15-2004, 08:15 PM

Posting Permissions

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


USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$826.09



MICRON MTA36ASF4G72PZ-2G6E1 | 32GB PC4-2666V ECC RDIMM Server RAM picture

MICRON MTA36ASF4G72PZ-2G6E1 | 32GB PC4-2666V ECC RDIMM Server RAM

$184.95



x4 Intel 128GB NMB1XXD128GPS Optane Memory 200 Series PMEM Module 3200 DDR4 RAM picture

x4 Intel 128GB NMB1XXD128GPS Optane Memory 200 Series PMEM Module 3200 DDR4 RAM

$329.99



SMART(Micron)SafeStor 32GB(1X32GB) 1RX4 NN4-3200AA(DDR4) HPE Server Memory picture

SMART(Micron)SafeStor 32GB(1X32GB) 1RX4 NN4-3200AA(DDR4) HPE Server Memory

$159.98



Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot picture

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot

$285.90



Samsung M386A8K40BM2-CTD6Q 64GB PC4-21300 2666MHz DDR4 RAM (UCS-ML-X64GRS-H) picture

Samsung M386A8K40BM2-CTD6Q 64GB PC4-21300 2666MHz DDR4 RAM (UCS-ML-X64GRS-H)

$350.00



Samsung (8X32GB) 256GB 2Rx4 PC4-2933Y-RB2-12 Registered ECC Memory DDR4 picture

Samsung (8X32GB) 256GB 2Rx4 PC4-2933Y-RB2-12 Registered ECC Memory DDR4

$1649.99



16GB(2x 8GB) Crucial DDR3L-1600 SODIMM / Lot of 2 8GB / Laptop RAM Memory / A25 picture

16GB(2x 8GB) Crucial DDR3L-1600 SODIMM / Lot of 2 8GB / Laptop RAM Memory / A25

$17.99



6 in 1 USB 3.0 Type C Card Reader SD Micro SD TF OTG Memory Adapter Laptop PC US picture

6 in 1 USB 3.0 Type C Card Reader SD Micro SD TF OTG Memory Adapter Laptop PC US

$3.95



USB3.0 SD Card Reader for PC Micro SD Card to USB Adapter for Camera Memory C picture

USB3.0 SD Card Reader for PC Micro SD Card to USB Adapter for Camera Memory C

$3.69