I would like to give 755 permissions to a directory, so I use:
# chmod -R 755 /my/folder/
It works for all files inside my folder, but the problem is that I use scripts that create new files in this folder, and by default the permissions are 600.
How could I impose, 755 permissions on these 'future' files ?
--EDIT--
I use a script that gives me info about network traffic on my campus. I have a new file every 10 minutes, located in a folder called journey, located in the month folder like this :
ls -lrt /home/netmet/secure/2017-04/2017-04-27/
total 118548
-rwxr-sr-x 1 root root 85922 avril 27 00:10 zzaccounting.dmp-00-00
-rwxr-sr-x 1 root root 54874 avril 27 00:20 zzaccounting.dmp-00-10
-rwxr-sr-x 1 root root 33534 avril 27 00:30 zzaccounting.dmp-00-20
-rwxr-sr-x 1 root root 48890 avril 27 00:40 zzaccounting.dmp-00-30
-rwxr-sr-x 1 root root 36878 avril 27 00:50 zzaccounting.dmp-00-40
-rwxr-sr-x 1 root root 37034 avril 27 01:00 zzaccounting.dmp-00-50
-rwxr-sr-x 1 root root 38154 avril 27 01:10 zzaccounting.dmp-01-00
-rwxr-sr-x 1 root root 38318 avril 27 01:20 zzaccounting.dmp-01-10
-rwxr-sr-x 1 root root 26978 avril 27 01:30 zzaccounting.dmp-01-20
-rwxr-sr-x 1 root root 31558 avril 27 01:40 zzaccounting.dmp-01-30
-rwxr-sr-x 1 root root 23662 avril 27 01:50 zzaccounting.dmp-01-40
-rwxr-sr-x 1 root root 32298 avril 27 02:00 zzaccounting.dmp-01-50
-rwxr-sr-x 1 root root 30282 avril 27 02:10 zzaccounting.dmp-02-00
-rwxr-sr-x 1 root root 31110 avril 27 02:20 zzaccounting.dmp-02-10
-rwxr-sr-x 1 root root 25718 avril 27 02:30 zzaccounting.dmp-02-20
-rwxr-sr-x 1 root root 26306 avril 27 02:40 zzaccounting.dmp-02-30
-rwxr-sr-x 1 root root 23690 avril 27 02:50 zzaccounting.dmp-02-40
-rwxr-sr-x 1 root root 23002 avril 27 03:00 zzaccounting.dmp-02-50
-rwxr-sr-x 1 root root 21854 avril 27 03:10 zzaccounting.dmp-03-00
Here I changed permissions by hand but when new the file appears, I have this :
-rw------- 1 root root 3479106 avril 27 15:50 zzaccounting.dmp-15-40
The thing is that for every folder and file under /home/netmet/secure/ I want 755 permision by default.
I have already done this :
chmod -R g+s /home/netmet/secure
setfacl -d -m g::rwx /home/netmet/secure
setfacl -d -m o::rx /home/netmet/secure
umask
, but not for overriding a program that creates files with mode0600
by design. See here for some references. – ilkkachu Apr 27 '17 at 12:06umask
for adding execution bit to files, this need to be done by hand – Romeo Ninov Apr 27 '17 at 13:012017-04-27
) and how are the directories made in the first place? Please update the question with these details. – Tigger Apr 28 '17 at 10:46open
etc.. – ss_iwe Apr 28 '17 at 10:54open(filename, permissions=NAZI_UGLY)
to create its files, there can be no (straightforward) fix unless you can fix the script itself. – tripleee Apr 28 '17 at 12:05umask 000 ; /the/program
to see if the rights are closer now to what you would need. umask "masks" (set to 0) some bits, here it will not set 0 to any bits (as the mask "000" have no bits at 1, and the bits at 1 are the ones that should be masked). If this doesn't help, you'll need a way to tell your program to use different rights, or do regular chmods on the folder structure ( ex:find /home/netmet/secure -mtime -1 -print0 | xargs -0 chmod a+rwx
) – Olivier Dulac Apr 28 '17 at 16:080755
and not0644
(u=rw,g=r,o=r
)? In which caseumask 022
before you run your data capture program may solve the problem. – Chris Davies May 06 '17 at 15:10