2

I try to configure how Nautilus, GEdit and other Gnome applications set new file and directory permissions (002 instead of the default 022).

After reading posts and trying things, I found a "working" solution. All the users use these settings :

mkdir /etc/systemd/user/dbus.service.d/
mkdir /etc/systemd/user/gnome-terminal-server.service.d/
echo -e "[Service]\nUMask=002\n" > /etc/systemd/user/dbus.service.d/override.conf
echo -e "[Service]\nUMask=002\n" > /etc/systemd/user/gnome-terminal-server.service.d/override.conf

After reading a few more posts I removed these files and directories and tried :

mkdir /etc/systemd/system/user@.service.d/
echo -e "[Service]\nUMask=002\n" > /etc/systemd/system/user@.service.d/override.conf

I did this because both dbus.service and gnome-terminal-server.service are under user@1000.service (systemd-cgls):

Control group /:
-.slice
├─user.slice
│ ├─user-1000.slice
│ │ └─user@1000.service
│ │   ├─gnome-terminal-server.service
│ │   │ ├─1763 /usr/lib/gnome-terminal/gnome-terminal-server
│ │   │ ├─1771 bash
│ │   ├─dbus.service
│ │   │ └─1973 /usr/bin/nautilus --gapplication-service

Unfortunately, executing umask in my terminal prints 0022 and not 0002 but GEdit and Nautilus use 002 (I created a new text file and a new directory).

What am I missing ?

  • 1
    Does your shell set the umask somewhere else (such as ~/.profile or /etc/profile)? – sebasth Jan 23 '18 at 7:21
  • No, I checked ~/.bashrc too. I never modify these files. If the first solution works for my terminals, we can probably assume bash doesn't override the umask. – sylvain Jan 24 '18 at 8:32
1

At least on fedora, bash overwrites the umask in /etc/bashrc

| improve this answer | |
  • Really? Are you sure? – G-Man Says 'Reinstate Monica' Dec 19 '18 at 14:25
  • @G-Man yes, it does, for non-login shells: for uids starting at 200, if the user matches the group name, it’s set to 002, otherwise 022. – Stephen Kitt Dec 19 '18 at 14:37
  • @StephenKitt: What we have here is a failure to communicate.  I guess you're saying that bash overrides the umask in /etc/bashrc.  I read the above answer as saying that bash overwrites the file /etc/bashrc, which I (still) doubt. – G-Man Says 'Reinstate Monica' Dec 19 '18 at 16:08
  • @G-Man ah, right, yes, bash doesn’t overwrite /etc/bashrc, but if the author had meant that, why mention “the umask in”? – Stephen Kitt Dec 19 '18 at 16:10
  • @StephenKitt If I modified a file, unconditionally setting a new value for one parameter (ignoring its existing value) and leaving the rest of the file unchanged, I might use similar language. – G-Man Says 'Reinstate Monica' Dec 19 '18 at 16:15
0

I have the workaround at least on Fedora 31:

sudo vi /etc/profile.d/umask.sh
umask <your_umask>

sudo vi /etc/login.defs
UMASK <your_umask>

sudo vi /usr/local/bin/systemd-user
/usr/lib/systemd/systemd --user

sudo chmod a+x /usr/local/bin/systemd-user

sudo vi /usr/lib/systemd/system/user@.service
ExecStart=-/usr/local/bin/systemd-user

It enables umask in all gnome apps launched by 'systemd --user' and enables umask in gnome-terminal too.

| improve this answer | |
  • Can you explain what that does? – RalfFriedl Jan 10 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.