ssh logging

Darren Tucker dtucker at
Tue May 5 21:56:02 EST 2009

On Tue, May 05, 2009 at 10:59:32AM +0200, Balázs Molnár wrote:
> Dear All,
> I am a newbie in the unix world.

Welcome aboard.

> I have a problem. I try to log all my typed, edited (via vi/vim) and
> of course the output/result of a command into a file (specific file e.g.:
> hostname_date_time.log into my home directory).

Typically, Unix tools are cooperative rather than comprehensive.  In this
particular case, OpenSSH does not provide keystroke logging.

Instead, the typical way to do this is to have a separate program do the
logging.  One such program is script(1).  You invoke it before running
the program that you want to record the output of.  Depending on your
platform, script may have an option to invoke the command directly,
in which case you could do what you describe with something like

datetime=`date '+%y-%m-%d_%H-%M'`
script -c "ssh $host" ${host}_${datetime}.log


> Secondly the Logging levels info, debug, verbose ... there is no
> description in the man. Which level logs what.

The logs that you describe are for diagnostic purposes, which is to say
that they do not record keystrokes.

The possible values are listed in sshd_config(5) in order from least
verbose to most verbose but the only way to know what the possible
outputs are is to check the source code.


Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list