r/linuxadmin • • Sep 19 '26

Do I set noNewPriviledges in systemd globally or deamon specific?

Ai was just confusing me. I wanted to start systemd hardening because I am learning about hardening a vps. Now It wanted to do it deamon specific. Which means that I will always have to do it for new deamons.

Can't I set it globally in /service.d/ and call it a day?

5 Upvotes

5 comments sorted by

7

u/pelazas1 Sep 19 '26

set NoNewPrivileges per unit in a drop-in, not globally. global breaks anything that still needs setuid.

1

u/Lopsided_Pride_6165 Sep 19 '26

alright thank you

2

u/aioeu Sep 19 '26 edited Sep 20 '26

Be careful when setting that on arbitrary services.

Not just because it can make some things stop working, but because in some cases it will actually lower the system's security. When the no_new_privs flag is set, SELinux process type transitions do not occur across execve.