I'm looking at the following line in /usr/lib/systemd/system/sshd.service file on a Fedora 25 box:ExecStart=/usr/sbin/sshd -D $OPTIONSI'm not sure where $OPTIONS comes from. It looks like an environment variable, although when I set a shell variable that way it is ignored, e.g.# OPTIONS='-p 9999'# systemctl start sshdI read through the command lines portion of the systemd.service man page, which indicates that environment variables can be set via an Environment line:Environment=ONE=one 'TWO=two two'However, no such OPTIONS variable is set there.There is additionally an EnvironmentFile line, e.g.:EnvironmentFile=-/etc/sysconfig/sshdNo $OPTIONS variable is set there either. To what does $OPTIONS refer, and how is it set?
What is $OPTIONS in a systemd service file?
systemd
The unit file in Debian is similar, containing:[Service]EnvironmentFile=-/etc/default/sshExecStart=/usr/sbin/sshd -D $SSHD_OPTSExecReload=/bin/kill -HUP $MAINPIDHere, the EnvironmentFile assigns SSHD_OPTS:# Options to pass to sshdSSHD_OPTS=It's likely that Fedora uses a similar system, but for some reason they just haven't explicitly set the variable. That shouldn't matter, it should expand to an empty string.There's a mention here that e.g. httpd.service uses OPTIONS similarly, and sets it in /etc/sysconfig/httpd. So it's likely just unset for some reason. You could check sshd's command line with ps to see what the variable is expanded to, and also set it to something in the sysconfig file to check that it works if set there.As for setting the environment variable on the shell command line, AFAIU systemd doesn't run the services in the environment of the shell calling systemctl, but forks them off the main systemd process. That way they don't inherit settings of the shell environment even accidentally. Environment variables can have a wide range of effects and it would be annoying to have your services act differently depending on if they are started at system boot or restarted from the command line.That $MAINPID however, it's special.