With ssh, I can do something like the following:

ssh user@host -t /path/to/some/shell

How can I automatically launch a shell on the server with mosh?

I have tried with

mosh user@host -ssh /path/to/some/shell

and with:

mosh user@host -ssh "ssh -t /path/to/some/shell"

with no luck. Is this at all possible?

1 Answer 1



mosh user@host -- /path/to/some/shell

The general form is:

mosh [options] -- user@host [command]

If you don't specify a command, mosh spawn a login shell by default.

  • Thanks. Any way to pass commands as well? That is, e.g. doing ssh -t machine@domain 'export STARTUP_OPTION="A"; exec /path/to/zsh' but with mosh (see this Q&A for more context) Commented Oct 8, 2015 at 18:20
  • I tried with mosh user@host -- "export LC_OPTION=A; /path/to/some/shell" without luck. Commented Oct 8, 2015 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .