3

In ssh, I can use ssh root@myhost -t "cd mydir; bash -i" to do that, how can I run 2 commands in mosh with one line

Remco Haszing
  • 7,178
  • 4
  • 40
  • 83
nwaicaethi
  • 175
  • 3
  • 10

1 Answers1

0

According to man mosh(1), you can do the same with mosh, but you need to add the -t option to the ssh:

mossh root@myhost --ssh="ssh -t" "cd mydir; bash -i"
Jakuje
  • 24,773
  • 12
  • 69
  • 75
  • It doesn't work, when i type `mosh root@rmt --ssh="ssh -vvv -t" "cd ~; bash -i"`, it return "debug1: Exit status 1 /usr/bin/mosh: Did not find mosh server startup message.", but mosh-server has running in server, when i type `mosh root@rmt`, it work. – nwaicaethi Sep 28 '15 at 04:24
  • and what about trying `mossh --server="cd mydir; mosh-server" root@myhost` ? – Jakuje Sep 28 '15 at 08:34
  • even I try `mosh --server="cd /tmp; mosh-server" root@rmt`, the startup dir still in "~/" – nwaicaethi Sep 28 '15 at 08:58
  • final thought: `mossh --server="mosh-server -- 'cd mydir; bash -i'" root@myhost`. It must work – Jakuje Sep 28 '15 at 09:09
  • even worse, when i run `roroco@roroco-Zhaoyang-K49 ~/Dropbox/rbs/ro_plans $ mosh --server="mosh-server -- 'cd /tmp; bash -i'" root@rmt`, it show "[mosh is exiting.]" – nwaicaethi Sep 28 '15 at 13:59