I'm quite new with MobaXterm. For each SSH session that I open to a given host, I want to log the terminal output to an individual file whose filename includes the given hostname + timestamp. I have thus setup my MobaXterm terminal settings with "&H_&Y-&M-&D-&T" as log filename, where "$H" is a variable standing for "hostname".

It works as a charm when opening a new session by clicking on "Session" icon from MobaXterm's GUI then select "SSH" and manually provide the hostname's FQDN I want to connect to.


Session -> SSH -> Remote host: "MyNas.MydomainName" ==> Log file name is properly set to "MyNas.MydomainName_2022-01-07-113521.log"

However, if I open a similar session from windows's command line prompt, the log filename's hostname part is set to "localhost", instead of my hostname.


C:\Program Misc\MobaXterm>MobaXterm_Personal_21.5.exe -newtab "ssh MyNas.MydomainName" ==> Log file name is wrongly set to "localhost_2022-01-07-113521.log"

Any insight ? Many thanks in advance for helping.

1 Answer 1


Because then the SSH connection isn't made by MobaXterm itself – it's made by a local command that runs inside the launched MobaXterm "local" session.

The ssh command invokes a standalone OpenSSH client (the Cygwin-based build that comes with MobaXterm, not the native version that comes with Windows). It seems to be a customized version that has some integration (for the file panel), but the app still treats it as a command running inside a local shell.

Meanwhile when you create an SSH session through the GUI, that doesn't use OpenSSH – it uses MobaXterm's own internal SSH code (which is copied from PuTTY).

There seems to be no way to create new SSH sessions through the command line, only load existing saved sessions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.