I am looking for a way to run SSH (OpenSSH in particular, but not necessarily) and log all commands that I run against the remote, to a file locally.
Running each command as an independent ssh command would indeed log each command to my local history, but it is generally UNdesirable to run e.g.
ssh email@example.com -- foo -a --bar baz
for every command.
I'd rather ssh into the server in a normal way, either through ssh itself, or through a wrapper command, like 'ssh-logging'.
I'm envisioning the program saving commands input through ssh into a file on the local client machine comparably to how shells do it, e.g. ~/.ssh_history seems like a good default, perhaps permuted per user+host combination, but I don't really care where it saves at this moment.
In short, I'd like something like the following to happen:
~ $ ssh firstname.lastname@example.org [user@host ~]$ foo --bar [user@host ~]$ exit ~ $ cat .ssh_history_user@host foo --bar exit ~ $
Does such a thing exist, either as an obscure OpenSSH client configuration, or as part of another open-source/libre ssh client, or as a thin wrapper program that can simply place themselves in the way of the user's stdin inputs, and transparently send them to the stdin of the running program while logging them? (I hear SecureCRT has a logging feature that is perhaps roughly like this, but at least in my personal life I have no desire to use non-FLOSS tools).