I am working with systemctl
to get value of the EnvironmentFile property from ssh.service unit file using the command systemctl show ssh.service -p EnvironmentFile
but it returns empty result.
The unit file itself contains this property. For example my unit file looks like this (cat /lib/systemd/system/ssh.service
):
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
Moreover if I do systemctl show ssh.service | grep EnvironmentFile
I get:
EnvironmentFile=/etc/default/ssh (ignore_errors=yes)
Almost all other properties work as expected, for example systemctl show ssh.service -p After
returns extended dependencies:
After=network.target auditd.service systemd-journald.socket basic.target sysinit.target system.slice
The same problem with the property ConditionPathExists, but in this case even grep doesn't show this property (systemctl show ssh.service | grep ConditionPathExists
prints nothing).
Why does this happen? And how to get EnvironmentFile property from a unit file without using grep
?