the following works fine on linux: root@ubuntu1:/test# /usr/sbin/sshd -D -h ssh_host_dsa_key -p 6789 on FreeBSD and OSX, once a client connects, the server exits. changing the path for the host key to an absolute one allows the server to function normally: beejmacbook:/test beej$ /opt/local/sbin/sshd -h /test/ssh_host_dsa_key -D -ddd -p 6789
What version is it that you're testing on Linux, and do you see the same results with a version built form vanilla source? I suspect it's not dependant on the the OS but rather on whether or not re-exec is enabled.
the testing i did for this bug report was with ubuntu's sshd OpenSSH_4.3p2 from their 4.3p2-5ubuntu1 deb. anyway, using vanilla 4.5p1 source with all defaults on the same linux test box does indeed break things like the other OS's when using a relative path for host key. and adding the -r flag fixes things again so you're right about this being related to re-exec :)
Created attachment 1288 [details] require absolute paths It is pretty easy to fix the specific case of the '-h' option not accepting relative paths, but fixing the more general problem of paths specified on the commandline using -oConfigItem=value or in configuration files is surprisingly tricky because of the way we pass the configuration between the original sshd instance and the re-executed child. Rather than writing a lot of code to fix this edge case, I think it is better that we just make the requirement to use absolute paths explicit and provide error feedback when the daemon is started, not when it tries to accept a connection.
Created attachment 1289 [details] better patch Actually, the last patch had two bugs: it broke the AuthorizedKeysFile directive (which allows paths relative to $HOME) and absolute paths specified using ~/ or ~user/. This one fixes these problems.
Created attachment 1290 [details] Working patch It helps if one saves the file that one is working on before making a broken patch and posting it for the world to see...
target for 5.4
Created attachment 1776 [details] /home/djm/sshd-abspath.diff de-relativise host key paths
Comment on attachment 1776 [details] /home/djm/sshd-abspath.diff ignore the Makefile.inc hunk
Comment on attachment 1776 [details] /home/djm/sshd-abspath.diff ok minus the XXX debugs.
revised patch applied, so this will be in OpenSSH 5.4. Thanks for the report.
With the release of 5.4p1, this bug is now considered closed.