setgid bit in umask of systemd service script

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a downloader service running, and I'd like it to set the setgid bit of every directory it creates. Its already doing so, but I suspect that's because at the moment, the parent directory also has setgid. What do I set the umask to?



I'm also wondering how umask, particularly in a systemd script, works for the "4th" digit. I understand that its inverted, so that umask = 002 is like chmod 775. But what about umask = 2002. Is that chmod 5775? or chmod 2775?



Thanks!







share|improve this question




















  • It should be 2775!
    – George Udosen
    Jan 22 at 1:33














up vote
1
down vote

favorite












I have a downloader service running, and I'd like it to set the setgid bit of every directory it creates. Its already doing so, but I suspect that's because at the moment, the parent directory also has setgid. What do I set the umask to?



I'm also wondering how umask, particularly in a systemd script, works for the "4th" digit. I understand that its inverted, so that umask = 002 is like chmod 775. But what about umask = 2002. Is that chmod 5775? or chmod 2775?



Thanks!







share|improve this question




















  • It should be 2775!
    – George Udosen
    Jan 22 at 1:33












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a downloader service running, and I'd like it to set the setgid bit of every directory it creates. Its already doing so, but I suspect that's because at the moment, the parent directory also has setgid. What do I set the umask to?



I'm also wondering how umask, particularly in a systemd script, works for the "4th" digit. I understand that its inverted, so that umask = 002 is like chmod 775. But what about umask = 2002. Is that chmod 5775? or chmod 2775?



Thanks!







share|improve this question












I have a downloader service running, and I'd like it to set the setgid bit of every directory it creates. Its already doing so, but I suspect that's because at the moment, the parent directory also has setgid. What do I set the umask to?



I'm also wondering how umask, particularly in a systemd script, works for the "4th" digit. I understand that its inverted, so that umask = 002 is like chmod 775. But what about umask = 2002. Is that chmod 5775? or chmod 2775?



Thanks!









share|improve this question











share|improve this question




share|improve this question










asked Jan 21 at 21:25









Kayson

82




82











  • It should be 2775!
    – George Udosen
    Jan 22 at 1:33
















  • It should be 2775!
    – George Udosen
    Jan 22 at 1:33















It should be 2775!
– George Udosen
Jan 22 at 1:33




It should be 2775!
– George Udosen
Jan 22 at 1:33










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










I believe the octal numbers for:



  • sticky bit is 1,

  • setgid on directories: 2, and

  • setuid on files: 4.

So for the case your asking it would be: umask 2002 ==> 2775 for folders.






share|improve this answer




















    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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f418694%2fsetgid-bit-in-umask-of-systemd-service-script%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    I believe the octal numbers for:



    • sticky bit is 1,

    • setgid on directories: 2, and

    • setuid on files: 4.

    So for the case your asking it would be: umask 2002 ==> 2775 for folders.






    share|improve this answer
























      up vote
      0
      down vote



      accepted










      I believe the octal numbers for:



      • sticky bit is 1,

      • setgid on directories: 2, and

      • setuid on files: 4.

      So for the case your asking it would be: umask 2002 ==> 2775 for folders.






      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I believe the octal numbers for:



        • sticky bit is 1,

        • setgid on directories: 2, and

        • setuid on files: 4.

        So for the case your asking it would be: umask 2002 ==> 2775 for folders.






        share|improve this answer












        I believe the octal numbers for:



        • sticky bit is 1,

        • setgid on directories: 2, and

        • setuid on files: 4.

        So for the case your asking it would be: umask 2002 ==> 2775 for folders.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 22 at 1:38









        George Udosen

        1,112318




        1,112318






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418694%2fsetgid-bit-in-umask-of-systemd-service-script%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?