This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can Cygwin sshd log to a file? (as opposed to Event Log)


RDD wrote:
> 
> Hello all --
> 
> I've modified the Logging section of cygwin\etc\cygserver.conf as follows:
> 
> # kern.log.syslog: Determines whether logging should go to the syslog,
> # Default is "yes", if stderr is no tty, "no" otherwise.
> # Command line option -y, --syslog or -Y, --no-syslog.
> kern.log.syslog --no-syslog
> 
> # kern.log.stderr: Determines whether logging should go to stderr,
> # Default is "yes", if stderr is a tty, "no" otherwise.
> # Command line option -e, --stderr or -E, --no-stderr.
> kern.log.stderr no
> 
> I would like to get the SSH server to log events (failed logins, etc.) to a
> simple text file, such as sshd.log under cygwin\var\log.  Is this possible?
> Or is this only a 'dummy' file, and Event Log in the only option for logging
> on Windows (Win2k in this case)?

You're barking up the wrong tree here with cygserver.conf.  THat is the
configuration file for cygserver, which is a helper application to
provide shared memory, queues, semaphores, and various other things. 
See /usr/share/doc/Cygwin/cygserver.README for details.  It has
absolutely nothing to do with sshd, or running services in general.

What you want to do is provide the "-e" argument to sshd when it starts
up.  From "man sshd":

     -e      When this option is specified, sshd will send the output to
the
             standard error instead of the system log.

(In windows, syslog = windows event log)

To do this you can either remove the service and reinstall it with the
new arguments (both with cygrunsrv) or you can just go into the registry
and edit the command line there.  Look at the ssh-host-config file for
how cygrunsrv is used to install the service, if you want to duplicate
its options.

Cygrunsrv is the program that allows daemons to run as services, and it
will redirect stderr and stdout of the daemon to a file.  From
"cygrunsrv -h":

  -0, --stdin <file>        Optional input file used for stdin
redirection.
                            Default is /dev/null.
  -1, --stdout <file>       Optional output file used for stdout
redirection.
                            Default is /var/log/<svc_name>.log.
  -2, --stderr <file>       Optional output file used for stderr
redirection.
                            Default is /var/log/<svc_name>.log.

You will either need to specify -2 to cygrunsrv with the name of the log
file you want, or accept the default /var/log/sshd.log.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]