2

I am attempting to change the default permissions assigned to a file by KDE. I would like to change the umask to 0027 so that the files are created with 750 for the permissions by default instead of 755 with the users. So far however, KDE has resisted my attempts to change this.

I have:

  • Added "umask 0027" to ~/.bashrc (It has also been added to /etc/profile for good measure)
  • Added "session optional pam_umask.so umask=0027" to /etc/pam.d/login
  • Changed "UMASK 022" to "UMASK 027" in /etc/login.defs

All resulting in no change outside of the SDDM to the permissions of new files. For extra info, the system is built on top of Debian 12.

Mr.Clean
  • 21
  • 3

1 Answers1

2

I had the same problem and solved it the following way. I'm using Ubuntu, so the solution will be very close to your problem, provided you are using systemd. And I suppose you do, because it's the default init on Debian.

Since KDE Plasma is launched by systemd unit, the best way to set umask is to use drop-in configuration file for a particular systemd service. Especially setting umask via ~/.profile or /etc/profile doesn't work anymore.

Most likely all your applications are launched directly or indirectly by plasmashell process and inherit umask from this process. The responsible systemd unit for this process is /usr/lib/systemd/user/plasma-plasmashell.service. In order to make plasmashell have umask=0027 you have to make drop-in configuration file: /etc/systemd/user/plasma-plasmashell.service.d/override.conf which corresponds with aforementioned systemd unit. Make the /etc/systemd/user/plasma-plasmashell.service.d/ directory, then make a override.conf file in it. The contents of the file should be:

[Service]
UMask=0027

Be careful to use capital "U" and "M".

This file will be processed on top of the corresponding unit file by systemd.

Restart your system and you will notice that files you create will have proper permissions. Of course if you log into virtual terminal, the umask will not be governed by this systemd setting. You can set umask additionally in ~/.profile to have proper permissions of files created in pure text environment.

My solution is partially based on this article from Arch Wiki