Ask Your Question
0

How to use $OPTIONS variable in systemd config files?

asked 2014-12-03 18:47:20 -0600

Charlweed gravatar image

updated 2014-12-04 16:18:52 -0600

I need to debug sshd, and so I want to pass "-ddd" as an option to the sshd executable when it starts up. in the systemd config file for sshd, /lib/systemd/system/sshd.service I see the command line is

ExecStart=/usr/sbin/sshd -D $OPTIONS

But I cannot find the documentation on where this variable is set, or how to set it myself.

This won't help my real problem, because inserting -ddd before $OPTIONS, prevents sshd from running as a daemon. I also saw that the config pulls in /etc/systemconfig/sshd, but OPTIONS is not set in that file. So how am I supposed to set it, and where is this documented?

Thanks!

edit retag flag offensive close merge delete

Comments

I don't know where $OPTIONS is supposed to be set, but I do know that if it's not set, it's treated as noting more than whitespace. (Try running echo $OPTIONS and see what you get.) Have you tried simply replacing the variable with -vvv and if so, what happened?

sideburns gravatar imagesideburns ( 2014-12-04 03:50:22 -0600 )edit

Reading the man page for sshd, it looks as though -d is only intended to be used when the program is run directly, not from a script because otherwise, there's no way for you to see the debug, unless you redirect stderr to a file. Have you tried that?

sideburns gravatar imagesideburns ( 2014-12-04 16:29:25 -0600 )edit
1

I compared with httpd.service where $OPTIONS is set in /etc/sysconfig/httpd to add additional options. Concerning your real problem: maybe it is not appropriate to debug sshd with systemd? I suggest to stop/disable sshd.service and try to launch it in debug mode via konsole. Output can be consulted directly and can be saved to a file.

kdg1955 gravatar imagekdg1955 ( 2014-12-05 08:43:17 -0600 )edit

+1 @kdg1955 - it seems like there is a larger problem we don't know about.

randomuser gravatar imagerandomuser ( 2014-12-05 08:45:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-12-05 11:55:02 -0600

Charlweed gravatar image

Thanks guys, I found it: Read the EnvironmentFile entry in the systemd.exec(5) man page.

EnvironmentFile=
Similar to Environment= but reads the environment variables from a text file. The text file should contain new-line-separated variable assignments.

I was confused because OPTIONS is not set in the /etc/systemconfig/sshd env file, and is therefore blank when the config file is "run", AND the variables currently defined in the env file, are NOT used in the conf file.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2014-12-03 18:47:20 -0600

Seen: 5,217 times

Last updated: Dec 05 '14