How can I get the ssh server to re-read its configuration file (/etc/sshd_config
), without killing existing ssh connections?
EDIT: If I run kill -HUP <SSHD_PID>
I kill the connection.
daemonsmacosssh
How can I get the ssh server to re-read its configuration file (/etc/sshd_config
), without killing existing ssh connections?
EDIT: If I run kill -HUP <SSHD_PID>
I kill the connection.
Best Answer
sshd doesn't "re-read" it's configuration file, it restarts itself (refer to man sshd(8)), however, it shouldn't kill the child/connections if you sent the SIGHUP to the PARENT of them all. That is when you are talking about sshd that binds to port 22, as in the "usual" with Linux/FreeBSD/etc. [there are exceptions and sysadmin reasons why to follow the MacOSX type route]
HOWEVER MacOSX have launchd as the one that listens to and handles port 22 (from my 10.10.4 machine):
It is launchd that might need to be "restarted" on macosx, or told about different ports to listen on for sshd, as launchd will spawn a new sshd for each port 22 connection that comes in.
check the following:
I've ssh'd to my router and back to demonstrate the issue, and you'll notice that the two processes are already "owned" by me. Compare this to a Linux system (my roouter) where you'll notice the third "real" sshd that is owned by root: