How to get sftp to respect my umask setting












0














I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?



Red Hat 7.4



/etc/ssh/sshd_config has the line:



Subsystem sftp internal-sftp -u 002


I've also tried



Subsystem sftp internal-sftp -u 0002


After each change I make to sshd_config I issue the following command:



sudo systemctl restart sshd.service


Then in a separate window I log into sftp.



Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:



drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


(last line having r-- as the group permission)



where I would expect:



drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


(last line having rw- as the group permission)



I've also tried



Subsystem sftp internal-sftp -u ug=rwx


but that one causes sftp to close the connection.
At least it confirms that I'm updating the right configuration file.










share|improve this question







New contributor




Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0














    I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?



    Red Hat 7.4



    /etc/ssh/sshd_config has the line:



    Subsystem sftp internal-sftp -u 002


    I've also tried



    Subsystem sftp internal-sftp -u 0002


    After each change I make to sshd_config I issue the following command:



    sudo systemctl restart sshd.service


    Then in a separate window I log into sftp.



    Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:



    drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
    drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
    -rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


    (last line having r-- as the group permission)



    where I would expect:



    drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
    drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
    -rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


    (last line having rw- as the group permission)



    I've also tried



    Subsystem sftp internal-sftp -u ug=rwx


    but that one causes sftp to close the connection.
    At least it confirms that I'm updating the right configuration file.










    share|improve this question







    New contributor




    Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0







      I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?



      Red Hat 7.4



      /etc/ssh/sshd_config has the line:



      Subsystem sftp internal-sftp -u 002


      I've also tried



      Subsystem sftp internal-sftp -u 0002


      After each change I make to sshd_config I issue the following command:



      sudo systemctl restart sshd.service


      Then in a separate window I log into sftp.



      Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:



      drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
      drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
      -rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


      (last line having r-- as the group permission)



      where I would expect:



      drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
      drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
      -rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


      (last line having rw- as the group permission)



      I've also tried



      Subsystem sftp internal-sftp -u ug=rwx


      but that one causes sftp to close the connection.
      At least it confirms that I'm updating the right configuration file.










      share|improve this question







      New contributor




      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?



      Red Hat 7.4



      /etc/ssh/sshd_config has the line:



      Subsystem sftp internal-sftp -u 002


      I've also tried



      Subsystem sftp internal-sftp -u 0002


      After each change I make to sshd_config I issue the following command:



      sudo systemctl restart sshd.service


      Then in a separate window I log into sftp.



      Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:



      drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
      drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
      -rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


      (last line having r-- as the group permission)



      where I would expect:



      drwxrwsr-x. 2 [myID]  [myGroup]         32 Dec 28 17:37 ./
      drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
      -rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]


      (last line having rw- as the group permission)



      I've also tried



      Subsystem sftp internal-sftp -u ug=rwx


      but that one causes sftp to close the connection.
      At least it confirms that I'm updating the right configuration file.







      sftp umask






      share|improve this question







      New contributor




      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 27 mins ago









      Charles Belov

      1




      1




      New contributor




      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Charles Belov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          In your sshd config file, try setting "ForceCommand" on your groups



          Match Group {GROUP_NAME}
          ForceCommand internal-sftp -u 0002


          Restart your sshd process for the new settings to take effect






          share|improve this answer








          New contributor




          John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















            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',
            autoActivateHeartbeat: false,
            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
            });


            }
            });






            Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491404%2fhow-to-get-sftp-to-respect-my-umask-setting%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









            0














            In your sshd config file, try setting "ForceCommand" on your groups



            Match Group {GROUP_NAME}
            ForceCommand internal-sftp -u 0002


            Restart your sshd process for the new settings to take effect






            share|improve this answer








            New contributor




            John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.























              0














              In your sshd config file, try setting "ForceCommand" on your groups



              Match Group {GROUP_NAME}
              ForceCommand internal-sftp -u 0002


              Restart your sshd process for the new settings to take effect






              share|improve this answer








              New contributor




              John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                0












                0








                0






                In your sshd config file, try setting "ForceCommand" on your groups



                Match Group {GROUP_NAME}
                ForceCommand internal-sftp -u 0002


                Restart your sshd process for the new settings to take effect






                share|improve this answer








                New contributor




                John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                In your sshd config file, try setting "ForceCommand" on your groups



                Match Group {GROUP_NAME}
                ForceCommand internal-sftp -u 0002


                Restart your sshd process for the new settings to take effect







                share|improve this answer








                New contributor




                John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 11 mins ago









                John

                101




                101




                New contributor




                John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                    Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.













                    Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.












                    Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.
















                    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%2f491404%2fhow-to-get-sftp-to-respect-my-umask-setting%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

                    サソリ

                    広島県道265号伴広島線

                    Accessing regular linux commands in Huawei's Dopra Linux