ssh -f won't detach properly when run from cron.

fraff fraff at
Tue Jul 26 00:20:02 EST 2005


In file ssh.c, in function "ssh_session2", this piece of code:

/* If requested, let ssh continue in the background. */
if (fork_after_authentication_flag)
    if (daemon(1, 1) < 0)
        fatal("daemon() failed: %.200s", strerror(errno));

implements the "-f" option, but when run from cron, it does not detach
properly because of the second parameter (noclose) of the daemon() function.

The result is a defunct process and a CRON process waiting for ssh to

I don't understand why the "noclose" parameter of daemon() is set to
"1", could somebody explain ?

thanks for all.


More information about the openssh-unix-dev mailing list