Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #184773 > unrolled thread

How to change default umask in Stretch?

Started by"Garrett R." <grtrbsn83@unseen.is>
First post2017-08-06 23:00 +0200
Last post2017-08-07 14:40 +0200
Articles 14 on this page of 34 — 9 participants

Back to article view | Back to linux.debian.user


Contents

  How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-06 23:00 +0200
    Re: How to change default umask in Stretch? Dennis Creedan <wingman619@gmail.com> - 2017-08-07 06:20 +0200
    Re: How to change default umask in Stretch? Felix Miata <mrmazda@earthlink.net> - 2017-08-07 07:00 +0200
      Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 17:30 +0200
        Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-07 17:40 +0200
          Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 17:50 +0200
            Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 19:20 +0200
              Re: How to change default umask in Stretch? Dejan Jocic <jodejka@gmail.com> - 2017-08-07 20:10 +0200
                Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 20:10 +0200
                  Re: How to change default umask in Stretch? Dejan Jocic <jodejka@gmail.com> - 2017-08-07 20:40 +0200
                    Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 21:10 +0200
                    Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 22:10 +0200
                      Re: How to change default umask in Stretch? David Wright <deblis@lionunicorn.co.uk> - 2017-08-07 22:50 +0200
                        Re: How to change default umask in Stretch? Reco <recoverym4n@gmail.com> - 2017-08-08 12:30 +0200
                          Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-09 14:10 +0200
                            Re: How to change default umask in Stretch? Reco <recoverym4n@gmail.com> - 2017-08-10 07:20 +0200
                            Re: How to change default umask in Stretch? Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM> - 2017-08-12 10:20 +0200
                          Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-09 14:40 +0200
                      Re: How to change default umask in Stretch? Henrique de Moraes Holschuh <hmh@debian.org> - 2017-08-07 23:20 +0200
                        Re: How to change default umask in Stretch? Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM> - 2017-08-12 11:10 +0200
                          Re: How to change default umask in Stretch? Henrique de Moraes Holschuh <hmh@debian.org> - 2017-08-12 14:30 +0200
                            Re: How to change default umask in Stretch? Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM> - 2017-08-12 22:20 +0200
            Re: How to change default umask in Stretch? Dejan Jocic <jodejka@gmail.com> - 2017-08-07 19:20 +0200
          Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 18:10 +0200
            Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-07 18:20 +0200
              Re: How to change default umask in Stretch? "Garrett R." <grtrbsn83@unseen.is> - 2017-08-07 18:40 +0200
                Re: How to change default umask in Stretch? Dejan Jocic <jodejka@gmail.com> - 2017-08-07 19:00 +0200
                  Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-07 19:10 +0200
                    Re: How to change default umask in Stretch? Dejan Jocic <jodejka@gmail.com> - 2017-08-07 19:10 +0200
                  Re: How to change default umask in Stretch? Dejan Jocic <jodejka@gmail.com> - 2017-08-07 19:10 +0200
                  Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-07 19:10 +0200
        Re: How to change default umask in Stretch? Felix Miata <mrmazda@earthlink.net> - 2017-08-07 19:00 +0200
          Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-07 19:20 +0200
    Re: How to change default umask in Stretch? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-07 14:40 +0200

Page 2 of 2 — ← Prev page 1 [2]


#185091

FromHenrique de Moraes Holschuh <hmh@debian.org>
Date2017-08-12 14:30 +0200
Message-ID<udDIe-Fw-9@gated-at.bofh.it>
In reply to#185088
On Sat, 12 Aug 2017, Jonathan de Boyne Pollard wrote:
> Henrique de Moraes Holschuh:
> > Note that the ideal implementation would be to inherit the umask [...]
> 
> Actually, the ideal implementation from the GNOME point of view would be for
> these programs to pass the umask from the client process to the server, just
> like they pass open file handles, the working directory, environment
> variables (including DISPLAY), and the arguments vector.

You'd have to always indirectly start an intermediate "gnome launcher"
thing (instead of the real program) that sets up the environment, then
exec the real program for that to work.

-- 
  Henrique Holschuh

[toc] | [prev] | [next] | [standalone]


#185101

FromJonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>
Date2017-08-12 22:20 +0200
Message-ID<udL34-5Bs-5@gated-at.bofh.it>
In reply to#185091
Henrique de Moraes Holschuh: > Note that the ideal implementation would 
be to inherit the umask [...] Jonathan de Boyne Pollard: > Actually, the 
ideal implementation from the GNOME point of view would be for > these 
programs to pass the umask from the client process to the server, just > 
like they pass open file handles, the working directory, environment > 
variables (including DISPLAY), and the arguments vector. > > 
* https://github.com/GNOME/gnome-terminal/blob/52f32f962a5ed34f8c31042f2f8276dc1710cc99/src/terminal.c#L317 
 > 
* https://github.com/GNOME/glib/blob/b51a0e7c63313ecfc0c6bbb9f2a8d99f193e51ea/gio/gapplication.c#L923 
Henrique de Moraes Holschuh: > You'd have to always indirectly start an 
intermediate "gnome launcher" > thing (instead of the real program) that 
sets up the environment, then > exec the real program for that to work. 
No, that would not be necessary at all. Think about how GNOME Terminal 
and GNOME Editor work. As I said: These are already passing a whole 
bunch of process state from the client to the server, in order to 
preserve things like the apparent semantics of GNOME Terminal windows 
"inheriting" the working directories of the invoking clients, when in 
reality there is no inheritance from those client processes going on at 
all. This would be just one more such item of process state.

[toc] | [prev] | [next] | [standalone]


#184838

FromDejan Jocic <jodejka@gmail.com>
Date2017-08-07 19:20 +0200
Message-ID<ubTR8-3eW-19@gated-at.bofh.it>
In reply to#184819
On 07-08-17, Garrett R. wrote:
> I apologize for the omissions.
> 
> I am booting debian to GDM. I login. I then open gedit (or libreoffice, etc). I type document. I save it.
> 


Have you tried to set in /etc/pam.d/login this:

session optional pam_umask.so umask=0077

Logout and login back after that?

[toc] | [prev] | [next] | [standalone]


#184823

From"Garrett R." <grtrbsn83@unseen.is>
Date2017-08-07 18:10 +0200
Message-ID<ubSLq-2uu-73@gated-at.bofh.it>
In reply to#184817
I have created a file named ".xsessionrc" and it is in my home folder (~/.xsessionrc). Within this file I wrote this: umask 077.

No change is evident. I first tried a relogin. No effect. I then rebooted. Also no effect. Creating documents still results in rw-r--r--.

(I am logging in with gnome display manager and opening documents from the gnome-shell interface, not from a terminal).


Is there a specific entry that I should have made in the ~/.xsessionrc file? Should I "undo" the entries I made at /etc/login.defs and/or ~/.profile? Those are still set to 077 as I mentioned previously. So I have /etc/login.defs, ~/.profile and ~/.xsessionrc all with entry "umask 077". But the result is rw-r--r--.

----- Original Message -----
From: "Greg Wooledge" <wooledg@eeg.ccf.org>
To: debian-user@lists.debian.org
Sent: Monday, August 7, 2017 11:37:24 AM
Subject: Re: How to change default umask in Stretch?

On Mon, Aug 07, 2017 at 03:25:27PM +0000, Garrett R. wrote:
> I have set /etc/login.defs to a umask of 077. Also, I commented out the USERGROUPS_ENAB entry.
> 
> When I create gedit documents (for example), I am getting rw-r--r--. This does not reflect umask 077.
> 
> I then went to ~/.profile and set umask there. But this had no effect on anything.

OK, you're not going to give us any details without tooth-pulling.
That sucks.  I will have to rely upon guesswork.

You used the word "login" and the word "gedit".  This tells me that you
may be concentrating, currently, one of the two following scenarios:

1) You login locally through a display manager into an X session.

2) You login locally on the Linux console and use startx to launch
   an X session.

Now, we can probably rule out #2, because you claim that modifications
to ~/.profile did not work.  There are various situations where you
*could* still be using console login + startx and have your changes in
~/.profile not take effect, but the simplest answer suggests you are
not doing that.

So, you're probably logging in through a display manager.

If you want to configure the X session that you get when logging in
through a Debian display manager, use the file ~/.xsessionrc
instead of ~/.profile.

See <https://wiki.debian.org/Xsession>.

Yes, Virginia, ~/.xsessionrc does not exist by default.  You would have
to create it.  (These days, users have to be *told* this for some reason.
They whine and moan if you don't reassure them that yes, it's OK that
a file doesn't exist and that they should create it.  Sad but true.
And this user top-posted, so I'm inclined to suspect he/she falls into
that group.)

No, I am not talking about ~/.xsession.  ~/.xsessionrc is a totally
different file.

[toc] | [prev] | [next] | [standalone]


#184824

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-08-07 18:20 +0200
Message-ID<ubSV8-2zz-97@gated-at.bofh.it>
In reply to#184823
On Mon, Aug 07, 2017 at 04:00:17PM +0000, Garrett R. wrote:
> I have created a file named ".xsessionrc" and it is in my home folder (~/.xsessionrc). Within this file I wrote this: umask 077.
> 
> No change is evident. I first tried a relogin. No effect. I then rebooted. Also no effect. Creating documents still results in rw-r--r--.

Easiest way to verify it would be to open a terminal and run "umask".

> (I am logging in with gnome display manager and opening documents from the gnome-shell interface, not from a terminal).

In that case, it sounds like GNOME is overriding your umask.  You may
have to ask a GNOME support list how to work around this.  The first
Google result I found suggests adding it in ~/.gnomerc instead (in
addition to a crapload of obviously, blatantly *wrong* answers, as
usual).  I don't know whether .gnomerc will work, but you can try.

Rebooting would not matter.  The ~/.xsessionrc file is read by the
Debian X session when you login.  The problem is, anything you set there
can be changed later, e.g. by GNOME.

I tested it just now on my system, creating a ~/.xsessionrc file
containing "umask 002", and then running "startx -- :1" from tty2.
This gave me a(nother) X session, in which the umask was set to 002 as
expected (confirmed by running umask in a terminal).  But I don't
use GNOME.  I just use a window manager, fvwm.

[toc] | [prev] | [next] | [standalone]


#184826

From"Garrett R." <grtrbsn83@unseen.is>
Date2017-08-07 18:40 +0200
Message-ID<ubTep-2HP-5@gated-at.bofh.it>
In reply to#184824
Terminal confirms my umask is 022. That is, my entries at login.defs, xsessionrc, etc are not working.

Thank you for your assistance, Greg. Before asking here, my research indicated gnome is the problem and it is because of systemd that there is a problem. I assumed because gnome is default on debian, you might have some insight. 

Thank you for your efforts, much appreciated.

----- Original Message -----
From: "Greg Wooledge" <wooledg@eeg.ccf.org>
To: debian-user@lists.debian.org
Sent: Monday, August 7, 2017 12:14:43 PM
Subject: Re: How to change default umask in Stretch?

On Mon, Aug 07, 2017 at 04:00:17PM +0000, Garrett R. wrote:
> I have created a file named ".xsessionrc" and it is in my home folder (~/.xsessionrc). Within this file I wrote this: umask 077.
> 
> No change is evident. I first tried a relogin. No effect. I then rebooted. Also no effect. Creating documents still results in rw-r--r--.

Easiest way to verify it would be to open a terminal and run "umask".

> (I am logging in with gnome display manager and opening documents from the gnome-shell interface, not from a terminal).

In that case, it sounds like GNOME is overriding your umask.  You may
have to ask a GNOME support list how to work around this.  The first
Google result I found suggests adding it in ~/.gnomerc instead (in
addition to a crapload of obviously, blatantly *wrong* answers, as
usual).  I don't know whether .gnomerc will work, but you can try.

Rebooting would not matter.  The ~/.xsessionrc file is read by the
Debian X session when you login.  The problem is, anything you set there
can be changed later, e.g. by GNOME.

I tested it just now on my system, creating a ~/.xsessionrc file
containing "umask 002", and then running "startx -- :1" from tty2.
This gave me a(nother) X session, in which the umask was set to 002 as
expected (confirmed by running umask in a terminal).  But I don't
use GNOME.  I just use a window manager, fvwm.

[toc] | [prev] | [next] | [standalone]


#184829

FromDejan Jocic <jodejka@gmail.com>
Date2017-08-07 19:00 +0200
Message-ID<ubTxL-2Qn-5@gated-at.bofh.it>
In reply to#184826
On 07-08-17, Garrett R. wrote:
> Terminal confirms my umask is 022. That is, my entries at login.defs, xsessionrc, etc are not working.
> 
> Thank you for your assistance, Greg. Before asking here, my research indicated gnome is the problem and it is because of systemd that there is a problem. I assumed because gnome is default on debian, you might have some insight. 
> 
> Thank you for your efforts, much appreciated.
> 

Depends on terminal. If you use xterm under Gnome, it will respect umask
settings, wherever those are, global or local in .profile or .bashrc.
But gnome-terminal does not respect those settings. Guess that you
should file bug against gnome.

[toc] | [prev] | [next] | [standalone]


#184830

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-08-07 19:10 +0200
Message-ID<ubTHr-3b4-1@gated-at.bofh.it>
In reply to#184829
On Mon, Aug 07, 2017 at 07:02:14PM +0200, Dejan Jocic wrote:
> Ehh, disregard please. Just checked with gnome-terminal here, and it did
> respect umask settings in .profile. But gedit did not.

If gnome-terminal is reading .profile, that means it must be running
your shell as a login shell, which is a questionable practice.

Yet another strike against GNOME, if true.

[toc] | [prev] | [next] | [standalone]


#184835

FromDejan Jocic <jodejka@gmail.com>
Date2017-08-07 19:10 +0200
Message-ID<ubTHt-3b4-39@gated-at.bofh.it>
In reply to#184830
On 07-08-17, Greg Wooledge wrote:
> On Mon, Aug 07, 2017 at 07:02:14PM +0200, Dejan Jocic wrote:
> > Ehh, disregard please. Just checked with gnome-terminal here, and it did
> > respect umask settings in .profile. But gedit did not.
> 
> If gnome-terminal is reading .profile, that means it must be running
> your shell as a login shell, which is a questionable practice.
> 
> Yet another strike against GNOME, if true.
> 

I run all my shells in terminal as login shells, because I prefer it
that way. If you do not like it, do not do it :P It has nothing to do
with Gnome.

[toc] | [prev] | [next] | [standalone]


#184832

FromDejan Jocic <jodejka@gmail.com>
Date2017-08-07 19:10 +0200
Message-ID<ubTHr-3b4-3@gated-at.bofh.it>
In reply to#184829
On 07-08-17, Dejan Jocic wrote:
> On 07-08-17, Garrett R. wrote:
> > Terminal confirms my umask is 022. That is, my entries at login.defs, xsessionrc, etc are not working.
> > 
> > Thank you for your assistance, Greg. Before asking here, my research indicated gnome is the problem and it is because of systemd that there is a problem. I assumed because gnome is default on debian, you might have some insight. 
> > 
> > Thank you for your efforts, much appreciated.
> > 
> 
> Depends on terminal. If you use xterm under Gnome, it will respect umask
> settings, wherever those are, global or local in .profile or .bashrc.
> But gnome-terminal does not respect those settings. Guess that you
> should file bug against gnome.
> 
> 
> 


Ehh, disregard please. Just checked with gnome-terminal here, and it did
respect umask settings in .profile. But gedit did not.

[toc] | [prev] | [next] | [standalone]


#184834

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-08-07 19:10 +0200
Message-ID<ubTHs-3b4-25@gated-at.bofh.it>
In reply to#184829
On Mon, Aug 07, 2017 at 06:54:13PM +0200, Dejan Jocic wrote:
> Depends on terminal. If you use xterm under Gnome, it will respect umask
> settings, wherever those are, global or local in .profile or .bashrc.
> But gnome-terminal does not respect those settings. Guess that you
> should file bug against gnome.

Parts of this paragraph are not correct.

Putting a umask command in .bashrc would cause it to be run every time
you run a non-login bash shell, for example by opening an xterm, or a
new tab inside a gnome-terminal.  That particular instance of bash would
have the umask that you expect, because it's overriding the terminal's
umask due to the command it reads in .bashrc.

But the OP was trying to get gedit's umask to be different, and I'm
guessing (s)he's running gedit directly from GNOME, e.g. from some
kind of drop-down menu or hotkey, not by typing the gedit command in
a terminal.  Thus, gedit only inherits the umask from the window
manager (or whatever its parent is), not from any instance of bash.

To set umask of the window manager (or whatever), the instructions I gave
previously should work.  They do for *my* window manager.  But GNOME
may unilaterally decide to *change* the user's umask to whatever GNOME
decides is a correct value.  We've seen other unsolvable questions from
GNOME users here, e.g. one person was trying to set LC_* locale variables,
and GNOME just blew them away.  I don't believe we ever found an answer
for how to make it stop doing that.

Anyway, GNOME is a disaster, with the software assuming that it knows
better than you what you want, and with (apparently) no way to tell
it how to act differently.

Fortunately we have lots of other choices.

[toc] | [prev] | [next] | [standalone]


#184828

FromFelix Miata <mrmazda@earthlink.net>
Date2017-08-07 19:00 +0200
Message-ID<ubTxL-2Qn-3@gated-at.bofh.it>
In reply to#184815
Garrett R. composed on 2017-08-07 15:25 (UTC):

> Please advise on where "/etc/profile.local" is. I can find no such entry.

Like any .local file, it's an optional file. Any .local files that may exist by
default have uncommented content only if the /local/ admin creates any.
-- 
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/

[toc] | [prev] | [next] | [standalone]


#184836

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-08-07 19:20 +0200
Message-ID<ubTR8-3eW-13@gated-at.bofh.it>
In reply to#184828
On Mon, Aug 07, 2017 at 12:55:37PM -0400, Felix Miata wrote:
> Garrett R. composed on 2017-08-07 15:25 (UTC):
> 
> > Please advise on where "/etc/profile.local" is. I can find no such entry.
> 
> Like any .local file, it's an optional file. Any .local files that may exist by
> default have uncommented content only if the /local/ admin creates any.

There is nothing in Debian's /etc/profile which reads such a file.

Debian's /etc/profile does, however, dot in all the files in
/etc/profile.d/.  No, wait.  Not all the files.  Just all the files
that end with a .sh suffix.  And you'd better not put spaces in the
filenames either, because there's a blatant bug right here:

  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done

I don't expect anything better; that would be foolish optimism in
violation of decades of historical precedent.

[toc] | [prev] | [next] | [standalone]


#184805

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-08-07 14:40 +0200
Message-ID<ubPua-8bG-21@gated-at.bofh.it>
In reply to#184773
On Sun, Aug 06, 2017 at 08:50:05PM +0000, Garrett R. wrote:
> It appears systemd now manages umask. Can someone please describe how I can change the default umask setting in Stretch?

The umask *of what*?  Of login shells?  Of files uploaded via ftpd?
Of files uploaded via sshd/builtin sftp?  Of desktop environment sessions
started from a display manager?  Of some random cron job?

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.debian.user


csiph-web