3

systemd directives used in the unit files are in the documentation listed using mixed case like UMask or AccuracySec. Is it actually necessary to follow this exact wording, or is it just good practice, but the parsing is actually case insensitive? I could not find anything neither in the documentation nor in the source code.

To be more specific. This is an example Drop-In overriding the UMask value:

[Service] UMask=0027 

Would the UMask directive be correctly read if written with different case?

[Service] umask=0027 

Using UMask as an example, because as far as I know the systemd directive name is the only place where the term is capitalized like this. The UNIX command name is umask in all lowercase, which is not surprising. Even the systemd documentation spells the term when it’s not a command name in all lowercase.

… The per-user umask may also be set via …

1 Answer 1

4

Yes, the directive names are case sensitive.

tl;dr

You can empirically check this by setting the value and then running systemctl show to list all directives set for the unit.

The default state without any drop-ins with a default umask value:

$ systemctl show sshd … UMask=0022 … 

If you set the value correctly by a Drop-In, the value changes:

$ cat /etc/systemd/system/sshd.service.d/override.conf [Service] UMask=0027 
$ systemctl show sshd … UMask=0027 … 

But if you use incorrect letter case in the directive name, the value is not picked:

$ cat /etc/systemd/system/sshd.service.d/override.conf [Service] umask=0027 
$ systemctl show sshd … UMask=0022 … 

You can use | grep -i umask to see the processed directives regardless of the case:

$ systemctl show sshd | grep -i umask UMask=0022 

Don’t forget to run systemctl daemon-reload after any change to the unit files when experimenting.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.