Permissions on Files:











up vote
7
down vote

favorite












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









share|improve this question




















  • 1




    ACL is the answer. This has been discussed before.
    – d3ag0s
    Apr 27 '17 at 11:43






  • 7




    ACL is the answer for overriding the umask, but not for overriding a program that creates files with mode 0600 by design. See here for some references.
    – ilkkachu
    Apr 27 '17 at 12:06








  • 1




    And one more detail: by default you can't use umask for adding execution bit to files, this need to be done by hand
    – Romeo Ninov
    Apr 27 '17 at 13:01










  • umask doesn't work guys
    – klaypez
    Apr 28 '17 at 9:40










  • Can you edit the script you use to make the files? How do the files get in to the final directory (eg. 2017-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:46















up vote
7
down vote

favorite












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









share|improve this question




















  • 1




    ACL is the answer. This has been discussed before.
    – d3ag0s
    Apr 27 '17 at 11:43






  • 7




    ACL is the answer for overriding the umask, but not for overriding a program that creates files with mode 0600 by design. See here for some references.
    – ilkkachu
    Apr 27 '17 at 12:06








  • 1




    And one more detail: by default you can't use umask for adding execution bit to files, this need to be done by hand
    – Romeo Ninov
    Apr 27 '17 at 13:01










  • umask doesn't work guys
    – klaypez
    Apr 28 '17 at 9:40










  • Can you edit the script you use to make the files? How do the files get in to the final directory (eg. 2017-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:46













up vote
7
down vote

favorite









up vote
7
down vote

favorite











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









share|improve this question















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






debian permissions chmod umask






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 at 15:12









Michael Prokopec

72116




72116










asked Apr 27 '17 at 11:41









klaypez

6819




6819








  • 1




    ACL is the answer. This has been discussed before.
    – d3ag0s
    Apr 27 '17 at 11:43






  • 7




    ACL is the answer for overriding the umask, but not for overriding a program that creates files with mode 0600 by design. See here for some references.
    – ilkkachu
    Apr 27 '17 at 12:06








  • 1




    And one more detail: by default you can't use umask for adding execution bit to files, this need to be done by hand
    – Romeo Ninov
    Apr 27 '17 at 13:01










  • umask doesn't work guys
    – klaypez
    Apr 28 '17 at 9:40










  • Can you edit the script you use to make the files? How do the files get in to the final directory (eg. 2017-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:46














  • 1




    ACL is the answer. This has been discussed before.
    – d3ag0s
    Apr 27 '17 at 11:43






  • 7




    ACL is the answer for overriding the umask, but not for overriding a program that creates files with mode 0600 by design. See here for some references.
    – ilkkachu
    Apr 27 '17 at 12:06








  • 1




    And one more detail: by default you can't use umask for adding execution bit to files, this need to be done by hand
    – Romeo Ninov
    Apr 27 '17 at 13:01










  • umask doesn't work guys
    – klaypez
    Apr 28 '17 at 9:40










  • Can you edit the script you use to make the files? How do the files get in to the final directory (eg. 2017-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:46








1




1




ACL is the answer. This has been discussed before.
– d3ag0s
Apr 27 '17 at 11:43




ACL is the answer. This has been discussed before.
– d3ag0s
Apr 27 '17 at 11:43




7




7




ACL is the answer for overriding the umask, but not for overriding a program that creates files with mode 0600 by design. See here for some references.
– ilkkachu
Apr 27 '17 at 12:06






ACL is the answer for overriding the umask, but not for overriding a program that creates files with mode 0600 by design. See here for some references.
– ilkkachu
Apr 27 '17 at 12:06






1




1




And one more detail: by default you can't use umask for adding execution bit to files, this need to be done by hand
– Romeo Ninov
Apr 27 '17 at 13:01




And one more detail: by default you can't use umask for adding execution bit to files, this need to be done by hand
– Romeo Ninov
Apr 27 '17 at 13:01












umask doesn't work guys
– klaypez
Apr 28 '17 at 9:40




umask doesn't work guys
– klaypez
Apr 28 '17 at 9:40












Can you edit the script you use to make the files? How do the files get in to the final directory (eg. 2017-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:46




Can you edit the script you use to make the files? How do the files get in to the final directory (eg. 2017-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:46










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Try to run umask in your folder. If it returns anything other than '0022' then this is your problem. In your case it should initialy output '0177'. The permission system when creating directory is basically computed:
default - umask 0777 is the default mode for directories, and 0666 to ordinary files, but there are different umasks, if I understand these things right. Try to execute umask a=rx,uu+w.



EDIT: You can use umask to give execute bit to directory to be able to cd into it, but not to files. These have to be given execute bit manually because of security. Simply add chmod +x <file> to your script. And, execute flag set on file anything other than executable has no effect.






share|improve this answer



















  • 1




    The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
    – Patrick Mevzek
    Nov 25 '17 at 22:21










  • That should be chmod a=rx,u+w in your reply.
    – Patrick Mevzek
    Nov 25 '17 at 22:22











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f361660%2fpermissions-on-files%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Try to run umask in your folder. If it returns anything other than '0022' then this is your problem. In your case it should initialy output '0177'. The permission system when creating directory is basically computed:
default - umask 0777 is the default mode for directories, and 0666 to ordinary files, but there are different umasks, if I understand these things right. Try to execute umask a=rx,uu+w.



EDIT: You can use umask to give execute bit to directory to be able to cd into it, but not to files. These have to be given execute bit manually because of security. Simply add chmod +x <file> to your script. And, execute flag set on file anything other than executable has no effect.






share|improve this answer



















  • 1




    The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
    – Patrick Mevzek
    Nov 25 '17 at 22:21










  • That should be chmod a=rx,u+w in your reply.
    – Patrick Mevzek
    Nov 25 '17 at 22:22















up vote
0
down vote













Try to run umask in your folder. If it returns anything other than '0022' then this is your problem. In your case it should initialy output '0177'. The permission system when creating directory is basically computed:
default - umask 0777 is the default mode for directories, and 0666 to ordinary files, but there are different umasks, if I understand these things right. Try to execute umask a=rx,uu+w.



EDIT: You can use umask to give execute bit to directory to be able to cd into it, but not to files. These have to be given execute bit manually because of security. Simply add chmod +x <file> to your script. And, execute flag set on file anything other than executable has no effect.






share|improve this answer



















  • 1




    The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
    – Patrick Mevzek
    Nov 25 '17 at 22:21










  • That should be chmod a=rx,u+w in your reply.
    – Patrick Mevzek
    Nov 25 '17 at 22:22













up vote
0
down vote










up vote
0
down vote









Try to run umask in your folder. If it returns anything other than '0022' then this is your problem. In your case it should initialy output '0177'. The permission system when creating directory is basically computed:
default - umask 0777 is the default mode for directories, and 0666 to ordinary files, but there are different umasks, if I understand these things right. Try to execute umask a=rx,uu+w.



EDIT: You can use umask to give execute bit to directory to be able to cd into it, but not to files. These have to be given execute bit manually because of security. Simply add chmod +x <file> to your script. And, execute flag set on file anything other than executable has no effect.






share|improve this answer














Try to run umask in your folder. If it returns anything other than '0022' then this is your problem. In your case it should initialy output '0177'. The permission system when creating directory is basically computed:
default - umask 0777 is the default mode for directories, and 0666 to ordinary files, but there are different umasks, if I understand these things right. Try to execute umask a=rx,uu+w.



EDIT: You can use umask to give execute bit to directory to be able to cd into it, but not to files. These have to be given execute bit manually because of security. Simply add chmod +x <file> to your script. And, execute flag set on file anything other than executable has no effect.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jul 15 '17 at 13:47

























answered Jul 15 '17 at 12:44









M. H.

12029




12029








  • 1




    The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
    – Patrick Mevzek
    Nov 25 '17 at 22:21










  • That should be chmod a=rx,u+w in your reply.
    – Patrick Mevzek
    Nov 25 '17 at 22:22














  • 1




    The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
    – Patrick Mevzek
    Nov 25 '17 at 22:21










  • That should be chmod a=rx,u+w in your reply.
    – Patrick Mevzek
    Nov 25 '17 at 22:22








1




1




The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
– Patrick Mevzek
Nov 25 '17 at 22:21




The umask shell command does not depend on the path, it only depends on the user running it, each user has a specific umask value, defined at login and that can be changed later. This defines how new file permissions are created.
– Patrick Mevzek
Nov 25 '17 at 22:21












That should be chmod a=rx,u+w in your reply.
– Patrick Mevzek
Nov 25 '17 at 22:22




That should be chmod a=rx,u+w in your reply.
– Patrick Mevzek
Nov 25 '17 at 22:22


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f361660%2fpermissions-on-files%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Morgemoulin

Scott Moir

Souastre