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.

1 Answer 1

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

2
  • Thank you so much! I added a small tweak to this and changed the UMask = 0027 in /etc/systemd/user/plasma-core.target.wants/plasma-plasmashell.service file, but it works!
    – Mr.Clean
    Commented Jul 27, 2023 at 1:28
  • +1: So, the answer itself didn't help me. I tried it and it didn't work.. but I'm on archlinux, and I was unable to find that article on my own; was looking from the wrong direction (KDE->Umask). The PAM method worked as instructed in the umask article's section for kde.
    – Josh C
    Commented May 6 at 2:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .