Mosh: Difference between revisions

From NixOS Wiki
imported>Samueldr
Inits with a non-obvious answer to a question
 
imported>Ghuntley
mNo edit summary
Line 14: Line 14:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
alias mosh-server "systemd-run --user --scope mosh-server"
alias mosh-server = "systemd-run --user --scope mosh-server"
</syntaxhighlight>
</syntaxhighlight>



Revision as of 02:46, 18 January 2018

Troubleshooting

Missing /run/user/1000

Using a mosh session, $XDG_RUNTIME_DIR (/run/user/1000) doesn't exist and causes issues such as:

  • nix-shell failing with Error in tempdir() using /run/user/1000/nix-shell.XXXXX

This is caused by the way mosh handles logging-in to the system, the login is actually handled by a short ssh session, which ends immediately. logind, as it is used, closes the user's session and cleans up behind, since there is no loingering configured by default.

As a workaround, it is possible to set an alias in the user's shell wrapping mosh-server to keep the session around.[1]

alias mosh-server = "systemd-run --user --scope mosh-server"

References