-
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.
-
Senior Member
registered user
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.

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.
-
That is exactly what I was looking for! Many thanks Dave.
Similar Threads
-
By finder in forum General Support
Replies: 1
Last Post: 04-13-2005, 03:40 PM
-
By finder in forum General Support
Replies: 0
Last Post: 04-13-2005, 01:30 AM
-
By Ezor in forum General Support
Replies: 2
Last Post: 01-04-2005, 07:26 PM
-
By newiaqua in forum Hdd Install / Debian / Apt
Replies: 4
Last Post: 12-26-2004, 07:49 PM
-
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
-
Forum Rules

HP ProLiant MicroServer AMD Athlon II Neo N36L 1.3GHz 8GB RAM 4-Bay NAS Server
$99.00

Supermicro 1027GR-TSF 1U Rackmount Server 2x Xeon 2.3GHz 128GB DDR3
$219.99

Supermicro 721-2 Mini Tower Black Computer Server NO Hdd
$375.00

Supermicro 505-2 Server
$280.00

New Barebones Supermicro 5019D Server, 4C/8T Xeon D-2123T, 1U Rackmountable, 10G
$449.99

1U Supermicro SuperServer 5019D-4C-FN8TP Xeon D-2123IT 4 Core 32GB X11SDV-4C-TP
$699.00

Supermicro 1U Server X11SCW-F Xeon E-2174G 16GB RAM 1x M.2 NVME 3x PCI-e 2x PSU
$220.00

Supermicro 1U Server 514-4 (X11SSZ-QF) | i7-7700 - 16GB DDR4 Ram - Rackmountable
$249.00

BOXX B157552 SuperMicro X10DRT-L 2x Intel 2630V4 NO RAM & SSD Server
$160.99

Supermicro CSE-833 3U 8-Bay Barebones, w/ power supply, trays, backpane, fans
$200.00