How to set default umask in Ubuntu 17.04?












2















In the past, I have always set umask at ~/.profile. I set a umask of 077 so my documents get a permission of 600 (rw-------). But setting this at ~/.profile no longer works in Ubuntu 17.04.



So as new documents get created in a gnome session on Ubuntu 17.04, where can I configure so that they get created with permission 600?










share|improve this question





























    2















    In the past, I have always set umask at ~/.profile. I set a umask of 077 so my documents get a permission of 600 (rw-------). But setting this at ~/.profile no longer works in Ubuntu 17.04.



    So as new documents get created in a gnome session on Ubuntu 17.04, where can I configure so that they get created with permission 600?










    share|improve this question



























      2












      2








      2


      1






      In the past, I have always set umask at ~/.profile. I set a umask of 077 so my documents get a permission of 600 (rw-------). But setting this at ~/.profile no longer works in Ubuntu 17.04.



      So as new documents get created in a gnome session on Ubuntu 17.04, where can I configure so that they get created with permission 600?










      share|improve this question
















      In the past, I have always set umask at ~/.profile. I set a umask of 077 so my documents get a permission of 600 (rw-------). But setting this at ~/.profile no longer works in Ubuntu 17.04.



      So as new documents get created in a gnome session on Ubuntu 17.04, where can I configure so that they get created with permission 600?







      permissions 17.04 .profile gnome-session umask






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 27 '17 at 11:45









      Ravexina

      33k1487114




      33k1487114










      asked Jun 27 '17 at 0:18









      G.W.G.W.

      3113




      3113






















          4 Answers
          4






          active

          oldest

          votes


















          2














          To set permissions for all directories and files that are created day-forward by any user:




          1. sudo nano /etc/pam.d/common-session

          2. Find the line with "session optional pam_umask.so"

          3. Change this to "session optional pam_umask.so umask=0077"

          4. Save the file.

          5. Reboot.


          New files will be 600.
          New directories will be 700.






          share|improve this answer































            0














            If you're using GDM, it doesn't read ~/.profile like LightDM does. And the terminal normally opens a non-login shell. The net effect is that ~/.profile is not loaded at all when you open a terminal after logging in using GDM.



            Either:




            • put your settings in ~/.bashrc, or

            • set your terminal to start a login shell, or

            • switch to LightDM






            share|improve this answer
























            • Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

              – Ziazis
              Jun 28 '17 at 8:56













            • OK, so? Did I say his issue doesn't exist?

              – muru
              Jun 28 '17 at 8:57



















            0














            # the default umask is set in /etc/profile; for setting the umask
            # for ssh logins, install and configure the libpam-umask package.
            #umask 022


            That's literally what your ~/.profile says. Did you relogin once changed? It should work fine.



            Also:



            This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login exists.


            Actually confirmed the issue on a freshly installed ubuntu 17.04. Even fully updating still causes this issue to arise and even ~/.bash_profileis ignored, there seems to be an issue with the command interpreter not reading those files after login.



            You can use ~/.bashrc for now, which still works fine and is read during login.



            So after digging a little into it, it seems bash is not run by default with the --login anymore which means it doesn't read the ~/.profile. Starting a new bash with the umask in ~/.profile with bash --login sets the umask correctly starting a bash without it though ignores the ~/.profile. Not sure what was changed but this seems like a bug to me unless it was intentionally changed.






            share|improve this answer


























            • Yes, I relogged in.

              – G.W.
              Jun 27 '17 at 14:47











            • And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

              – G.W.
              Jun 27 '17 at 16:31













            • Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

              – Ziazis
              Jun 28 '17 at 8:36











            • Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

              – G.W.
              Jun 28 '17 at 14:42



















            0














            Ubuntu 18.04, should work for 17.04 and others



            According to the man pages, there are several places where we can set the umask for the PAM module to find; it even gives an example. I'll set it in /etc/pam.d/login. Note this file does not exist on my version of Ubuntu, in which case we can create it.



            $ sudo sh -c "echo 'session optional pam_umask.so umask=0027' >> /etc/default/login"

            $ more /etc/default/login
            session optional pam_umask.so umask=0027


            Evil Bug



            Now if we restart and ask for the umask in the terminal we still get 0022 and not the 0027 that was set. See Bug #1685754.



            But if we open an application, for example the Text Editor, and save a file we'll notice the new umask is set correctly. Open it from the menu, not from the terminal as it seems to pick up the (bad) umask from the terminal.



            $ touch terminal-file
            $ ls -l
            -rw-r----- 1 daniel daniel 0 jan 28 21:21 gedit-file
            -rw-r--r-- 1 daniel daniel 0 jan 28 21:22 terminal-file


            References




            • Ubuntu Manpage for pam_umask

            • Bug #1685754, since 17.04






            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              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: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              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%2faskubuntu.com%2fquestions%2f929439%2fhow-to-set-default-umask-in-ubuntu-17-04%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              To set permissions for all directories and files that are created day-forward by any user:




              1. sudo nano /etc/pam.d/common-session

              2. Find the line with "session optional pam_umask.so"

              3. Change this to "session optional pam_umask.so umask=0077"

              4. Save the file.

              5. Reboot.


              New files will be 600.
              New directories will be 700.






              share|improve this answer




























                2














                To set permissions for all directories and files that are created day-forward by any user:




                1. sudo nano /etc/pam.d/common-session

                2. Find the line with "session optional pam_umask.so"

                3. Change this to "session optional pam_umask.so umask=0077"

                4. Save the file.

                5. Reboot.


                New files will be 600.
                New directories will be 700.






                share|improve this answer


























                  2












                  2








                  2







                  To set permissions for all directories and files that are created day-forward by any user:




                  1. sudo nano /etc/pam.d/common-session

                  2. Find the line with "session optional pam_umask.so"

                  3. Change this to "session optional pam_umask.so umask=0077"

                  4. Save the file.

                  5. Reboot.


                  New files will be 600.
                  New directories will be 700.






                  share|improve this answer













                  To set permissions for all directories and files that are created day-forward by any user:




                  1. sudo nano /etc/pam.d/common-session

                  2. Find the line with "session optional pam_umask.so"

                  3. Change this to "session optional pam_umask.so umask=0077"

                  4. Save the file.

                  5. Reboot.


                  New files will be 600.
                  New directories will be 700.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 28 '17 at 19:07









                  TooManyPetsTooManyPets

                  30116




                  30116

























                      0














                      If you're using GDM, it doesn't read ~/.profile like LightDM does. And the terminal normally opens a non-login shell. The net effect is that ~/.profile is not loaded at all when you open a terminal after logging in using GDM.



                      Either:




                      • put your settings in ~/.bashrc, or

                      • set your terminal to start a login shell, or

                      • switch to LightDM






                      share|improve this answer
























                      • Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

                        – Ziazis
                        Jun 28 '17 at 8:56













                      • OK, so? Did I say his issue doesn't exist?

                        – muru
                        Jun 28 '17 at 8:57
















                      0














                      If you're using GDM, it doesn't read ~/.profile like LightDM does. And the terminal normally opens a non-login shell. The net effect is that ~/.profile is not loaded at all when you open a terminal after logging in using GDM.



                      Either:




                      • put your settings in ~/.bashrc, or

                      • set your terminal to start a login shell, or

                      • switch to LightDM






                      share|improve this answer
























                      • Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

                        – Ziazis
                        Jun 28 '17 at 8:56













                      • OK, so? Did I say his issue doesn't exist?

                        – muru
                        Jun 28 '17 at 8:57














                      0












                      0








                      0







                      If you're using GDM, it doesn't read ~/.profile like LightDM does. And the terminal normally opens a non-login shell. The net effect is that ~/.profile is not loaded at all when you open a terminal after logging in using GDM.



                      Either:




                      • put your settings in ~/.bashrc, or

                      • set your terminal to start a login shell, or

                      • switch to LightDM






                      share|improve this answer













                      If you're using GDM, it doesn't read ~/.profile like LightDM does. And the terminal normally opens a non-login shell. The net effect is that ~/.profile is not loaded at all when you open a terminal after logging in using GDM.



                      Either:




                      • put your settings in ~/.bashrc, or

                      • set your terminal to start a login shell, or

                      • switch to LightDM







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 28 '17 at 8:41









                      murumuru

                      1




                      1













                      • Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

                        – Ziazis
                        Jun 28 '17 at 8:56













                      • OK, so? Did I say his issue doesn't exist?

                        – muru
                        Jun 28 '17 at 8:57



















                      • Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

                        – Ziazis
                        Jun 28 '17 at 8:56













                      • OK, so? Did I say his issue doesn't exist?

                        – muru
                        Jun 28 '17 at 8:57

















                      Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

                      – Ziazis
                      Jun 28 '17 at 8:56







                      Actually I just confirmed his issue on a freshly installed 17.04 version. Has nothing to do with GDM since by default lightDM is still used.

                      – Ziazis
                      Jun 28 '17 at 8:56















                      OK, so? Did I say his issue doesn't exist?

                      – muru
                      Jun 28 '17 at 8:57





                      OK, so? Did I say his issue doesn't exist?

                      – muru
                      Jun 28 '17 at 8:57











                      0














                      # the default umask is set in /etc/profile; for setting the umask
                      # for ssh logins, install and configure the libpam-umask package.
                      #umask 022


                      That's literally what your ~/.profile says. Did you relogin once changed? It should work fine.



                      Also:



                      This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login exists.


                      Actually confirmed the issue on a freshly installed ubuntu 17.04. Even fully updating still causes this issue to arise and even ~/.bash_profileis ignored, there seems to be an issue with the command interpreter not reading those files after login.



                      You can use ~/.bashrc for now, which still works fine and is read during login.



                      So after digging a little into it, it seems bash is not run by default with the --login anymore which means it doesn't read the ~/.profile. Starting a new bash with the umask in ~/.profile with bash --login sets the umask correctly starting a bash without it though ignores the ~/.profile. Not sure what was changed but this seems like a bug to me unless it was intentionally changed.






                      share|improve this answer


























                      • Yes, I relogged in.

                        – G.W.
                        Jun 27 '17 at 14:47











                      • And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

                        – G.W.
                        Jun 27 '17 at 16:31













                      • Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

                        – Ziazis
                        Jun 28 '17 at 8:36











                      • Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

                        – G.W.
                        Jun 28 '17 at 14:42
















                      0














                      # the default umask is set in /etc/profile; for setting the umask
                      # for ssh logins, install and configure the libpam-umask package.
                      #umask 022


                      That's literally what your ~/.profile says. Did you relogin once changed? It should work fine.



                      Also:



                      This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login exists.


                      Actually confirmed the issue on a freshly installed ubuntu 17.04. Even fully updating still causes this issue to arise and even ~/.bash_profileis ignored, there seems to be an issue with the command interpreter not reading those files after login.



                      You can use ~/.bashrc for now, which still works fine and is read during login.



                      So after digging a little into it, it seems bash is not run by default with the --login anymore which means it doesn't read the ~/.profile. Starting a new bash with the umask in ~/.profile with bash --login sets the umask correctly starting a bash without it though ignores the ~/.profile. Not sure what was changed but this seems like a bug to me unless it was intentionally changed.






                      share|improve this answer


























                      • Yes, I relogged in.

                        – G.W.
                        Jun 27 '17 at 14:47











                      • And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

                        – G.W.
                        Jun 27 '17 at 16:31













                      • Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

                        – Ziazis
                        Jun 28 '17 at 8:36











                      • Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

                        – G.W.
                        Jun 28 '17 at 14:42














                      0












                      0








                      0







                      # the default umask is set in /etc/profile; for setting the umask
                      # for ssh logins, install and configure the libpam-umask package.
                      #umask 022


                      That's literally what your ~/.profile says. Did you relogin once changed? It should work fine.



                      Also:



                      This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login exists.


                      Actually confirmed the issue on a freshly installed ubuntu 17.04. Even fully updating still causes this issue to arise and even ~/.bash_profileis ignored, there seems to be an issue with the command interpreter not reading those files after login.



                      You can use ~/.bashrc for now, which still works fine and is read during login.



                      So after digging a little into it, it seems bash is not run by default with the --login anymore which means it doesn't read the ~/.profile. Starting a new bash with the umask in ~/.profile with bash --login sets the umask correctly starting a bash without it though ignores the ~/.profile. Not sure what was changed but this seems like a bug to me unless it was intentionally changed.






                      share|improve this answer















                      # the default umask is set in /etc/profile; for setting the umask
                      # for ssh logins, install and configure the libpam-umask package.
                      #umask 022


                      That's literally what your ~/.profile says. Did you relogin once changed? It should work fine.



                      Also:



                      This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login exists.


                      Actually confirmed the issue on a freshly installed ubuntu 17.04. Even fully updating still causes this issue to arise and even ~/.bash_profileis ignored, there seems to be an issue with the command interpreter not reading those files after login.



                      You can use ~/.bashrc for now, which still works fine and is read during login.



                      So after digging a little into it, it seems bash is not run by default with the --login anymore which means it doesn't read the ~/.profile. Starting a new bash with the umask in ~/.profile with bash --login sets the umask correctly starting a bash without it though ignores the ~/.profile. Not sure what was changed but this seems like a bug to me unless it was intentionally changed.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jun 28 '17 at 8:59

























                      answered Jun 27 '17 at 11:04









                      ZiazisZiazis

                      1,913419




                      1,913419













                      • Yes, I relogged in.

                        – G.W.
                        Jun 27 '17 at 14:47











                      • And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

                        – G.W.
                        Jun 27 '17 at 16:31













                      • Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

                        – Ziazis
                        Jun 28 '17 at 8:36











                      • Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

                        – G.W.
                        Jun 28 '17 at 14:42



















                      • Yes, I relogged in.

                        – G.W.
                        Jun 27 '17 at 14:47











                      • And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

                        – G.W.
                        Jun 27 '17 at 16:31













                      • Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

                        – Ziazis
                        Jun 28 '17 at 8:36











                      • Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

                        – G.W.
                        Jun 28 '17 at 14:42

















                      Yes, I relogged in.

                      – G.W.
                      Jun 27 '17 at 14:47





                      Yes, I relogged in.

                      – G.W.
                      Jun 27 '17 at 14:47













                      And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

                      – G.W.
                      Jun 27 '17 at 16:31







                      And the only ~/.bash files I have are .bashrc, .bash_logout, .bash_history. I ran a find search. .bash_profile and .bash_login do NOT exist on machine.

                      – G.W.
                      Jun 27 '17 at 16:31















                      Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

                      – Ziazis
                      Jun 28 '17 at 8:36





                      Oh, I'm sorry you are actually right. I just freshly installed a 17.04 to test it on a new installation and it actually isn't read from ~/.profile for some reason. I haven't digged into it yet. But you can add your umask into ~/.bashrc for now this is still read during startup.

                      – Ziazis
                      Jun 28 '17 at 8:36













                      Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

                      – G.W.
                      Jun 28 '17 at 14:42





                      Ziazis, setting umask in .bashrc only works for docs created in terminal. I'm looking to get umask applied for example from doc created in gedit. You have found a fix with bash -login? How do I implement this exactly? Or is this unfixable until a bug is fixed?

                      – G.W.
                      Jun 28 '17 at 14:42











                      0














                      Ubuntu 18.04, should work for 17.04 and others



                      According to the man pages, there are several places where we can set the umask for the PAM module to find; it even gives an example. I'll set it in /etc/pam.d/login. Note this file does not exist on my version of Ubuntu, in which case we can create it.



                      $ sudo sh -c "echo 'session optional pam_umask.so umask=0027' >> /etc/default/login"

                      $ more /etc/default/login
                      session optional pam_umask.so umask=0027


                      Evil Bug



                      Now if we restart and ask for the umask in the terminal we still get 0022 and not the 0027 that was set. See Bug #1685754.



                      But if we open an application, for example the Text Editor, and save a file we'll notice the new umask is set correctly. Open it from the menu, not from the terminal as it seems to pick up the (bad) umask from the terminal.



                      $ touch terminal-file
                      $ ls -l
                      -rw-r----- 1 daniel daniel 0 jan 28 21:21 gedit-file
                      -rw-r--r-- 1 daniel daniel 0 jan 28 21:22 terminal-file


                      References




                      • Ubuntu Manpage for pam_umask

                      • Bug #1685754, since 17.04






                      share|improve this answer




























                        0














                        Ubuntu 18.04, should work for 17.04 and others



                        According to the man pages, there are several places where we can set the umask for the PAM module to find; it even gives an example. I'll set it in /etc/pam.d/login. Note this file does not exist on my version of Ubuntu, in which case we can create it.



                        $ sudo sh -c "echo 'session optional pam_umask.so umask=0027' >> /etc/default/login"

                        $ more /etc/default/login
                        session optional pam_umask.so umask=0027


                        Evil Bug



                        Now if we restart and ask for the umask in the terminal we still get 0022 and not the 0027 that was set. See Bug #1685754.



                        But if we open an application, for example the Text Editor, and save a file we'll notice the new umask is set correctly. Open it from the menu, not from the terminal as it seems to pick up the (bad) umask from the terminal.



                        $ touch terminal-file
                        $ ls -l
                        -rw-r----- 1 daniel daniel 0 jan 28 21:21 gedit-file
                        -rw-r--r-- 1 daniel daniel 0 jan 28 21:22 terminal-file


                        References




                        • Ubuntu Manpage for pam_umask

                        • Bug #1685754, since 17.04






                        share|improve this answer


























                          0












                          0








                          0







                          Ubuntu 18.04, should work for 17.04 and others



                          According to the man pages, there are several places where we can set the umask for the PAM module to find; it even gives an example. I'll set it in /etc/pam.d/login. Note this file does not exist on my version of Ubuntu, in which case we can create it.



                          $ sudo sh -c "echo 'session optional pam_umask.so umask=0027' >> /etc/default/login"

                          $ more /etc/default/login
                          session optional pam_umask.so umask=0027


                          Evil Bug



                          Now if we restart and ask for the umask in the terminal we still get 0022 and not the 0027 that was set. See Bug #1685754.



                          But if we open an application, for example the Text Editor, and save a file we'll notice the new umask is set correctly. Open it from the menu, not from the terminal as it seems to pick up the (bad) umask from the terminal.



                          $ touch terminal-file
                          $ ls -l
                          -rw-r----- 1 daniel daniel 0 jan 28 21:21 gedit-file
                          -rw-r--r-- 1 daniel daniel 0 jan 28 21:22 terminal-file


                          References




                          • Ubuntu Manpage for pam_umask

                          • Bug #1685754, since 17.04






                          share|improve this answer













                          Ubuntu 18.04, should work for 17.04 and others



                          According to the man pages, there are several places where we can set the umask for the PAM module to find; it even gives an example. I'll set it in /etc/pam.d/login. Note this file does not exist on my version of Ubuntu, in which case we can create it.



                          $ sudo sh -c "echo 'session optional pam_umask.so umask=0027' >> /etc/default/login"

                          $ more /etc/default/login
                          session optional pam_umask.so umask=0027


                          Evil Bug



                          Now if we restart and ask for the umask in the terminal we still get 0022 and not the 0027 that was set. See Bug #1685754.



                          But if we open an application, for example the Text Editor, and save a file we'll notice the new umask is set correctly. Open it from the menu, not from the terminal as it seems to pick up the (bad) umask from the terminal.



                          $ touch terminal-file
                          $ ls -l
                          -rw-r----- 1 daniel daniel 0 jan 28 21:21 gedit-file
                          -rw-r--r-- 1 daniel daniel 0 jan 28 21:22 terminal-file


                          References




                          • Ubuntu Manpage for pam_umask

                          • Bug #1685754, since 17.04







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 28 at 21:29









                          DanielDaniel

                          1,47121427




                          1,47121427






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • 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%2faskubuntu.com%2fquestions%2f929439%2fhow-to-set-default-umask-in-ubuntu-17-04%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

                              How to change which sound is reproduced for terminal bell?

                              Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                              Can I use Tabulator js library in my java Spring + Thymeleaf project?