MOSH(1)

πŸ’– MOSH-SERVER πŸ’– (that's mosh-server(1), from the General Commands Manual bestie)

okay so picture this: it's giving server-side helper for mosh and honestly? iconic.


✨ NAME ✨

mosh-server β€” the server-side helper for mosh, no cap πŸ’…


🌸 SYNOPSIS 🌸

mosh-server new [-s] [-v] [-i IP] [-p PORT[:PORT2]] [-c COLORS] [-- command...]

πŸ¦‹ DESCRIPTION πŸ¦‹

so mosh-server is a helper program for the mosh(1) remote terminal application. it's the backstage crew, the bestie behind the curtain, the one doing the real work while everybody else gets the applause 🫢

here's the whole vibe: mosh-server binds to a high UDP port and chooses an encryption key to protect the session. it prints both of those on standard output, detaches from the terminal, and then just… waits. patiently. like a main character who knows their moment is coming. it's waiting for the mosh-client to establish a connection ✨

and if no client has contacted it within 60 seconds? it exits. it's gone. it said "okay well" and left πŸ’€

by default, mosh-server binds to a port between 60000 and 61000 and executes the user's login shell. very demure, very mindful.

on platforms with utempter, mosh-server maintains an entry in the utmp(5) file. and that entry shows:

  • its process ID
  • whether the session is connected
  • the client's current IP address

and finally: mosh-server exits when the client terminates the connection. when it's over, it's over. periodt.


πŸ‘‘ OPTIONS πŸ‘‘

real talk first: the argument new must be first on the command line to use command-line options. new is the VIP at the front of the line, everyone else waits πŸ”₯
  • -s β€” bind to the local interface used for an incoming SSH connection, given in the SSH_CONNECTION environment variable (for multihomed hosts)
  • -v β€” print some debugging information even after detaching. more instances of this flag = more debugging information. stack 'em, bestie, it's multiplicative energy πŸŽ€
  • -i IP β€” IP address of the local interface to bind (for multihomed hosts)
  • -p PORT[:PORT2] β€” UDP port number or port-range to bind. -p 0 will let the operating system pick an available UDP port. letting the OS choose? that's called delegating and it's a slay
  • -c COLORS β€” number of colors to advertise to applications through TERM (e.g. 8, 256)
  • -l NAME=VALUE β€” locale-related environment variable to try as part of a fallback environment, if the startup environment does not specify a character set of UTF-8

🌈 ENVIRONMENT VARIABLES 🌈

these variables allow server-side configuration of Mosh's behavior, which is lowkey powerful. they may be set by:

  • administrators, in system login/rc files, /etc/login.conf, or similar mechanisms
  • users, in their shell's login/rc files

mosh-server passes these variables to the login session and shell that it starts, but changing them there will have no effect. so set them in the right place, bestie, or it's giving "I decorated a room nobody will ever enter" 😭

  • MOSH_SERVER_NETWORK_TMOUT β€” if this variable is set to a positive integer number, it specifies how long (in seconds) mosh-server will wait to receive an update from the client before exiting. and listen: since mosh is very useful for mobile clients with intermittent operation and connectivity, we suggest setting this variable to a high value, such as 604800 (one week) or 2592000 (30 days). otherwise, mosh-server will wait indefinitely for a client to reappear. this variable is somewhat similar to the TMOUT variable found in many Bourne shells. however, it is not a login-session inactivity timeout; it only applies to network connectivity. read that twice, it matters πŸ’œ
  • MOSH_SERVER_SIGNAL_TMOUT β€” if this variable is set to a positive integer number, it specifies how long (in seconds) mosh-server will ignore SIGUSR1 while waiting to receive an update from the client. otherwise, SIGUSR1 will always terminate mosh-server. users and administrators may implement scripts to clean up disconnected Mosh sessions. with this variable set, a user or administrator can issue
$ pkill -SIGUSR1 mosh-server

to kill disconnected sessions without killing connected login sessions. that's the whole trick. it's giving surgical. it's giving precision. it's giving "I only want the zombies gone" 🧚


πŸ’… EXAMPLE πŸ’…

$ mosh-server

MOSH CONNECT 60001 UAkFedSsVJs2LfMeKyQB5g

mosh-server (mosh 1.1)
[...] (copyright notice omitted)

[mosh-server detached, pid = 20443]

look at that output. the port, the key, the detach, the pid. chef's kiss, no notes πŸ”₯


⭐ SEE ALSO ⭐

project home page: https://mosh.org 🌈


πŸŽ€ AUTHOR πŸŽ€

mosh was written by Keith Winstein <mosh-devel@mit.edu>. thank you for your service king πŸ‘‘


πŸ™ˆ BUGS πŸ™ˆ

please report bugs to mosh-devel@mit.edu. users may also subscribe to the mosh-users@mit.edu mailing list, at http://mailman.mit.edu/mailman/listinfo/mosh-users β€” come hang out, we're all in the group chat together πŸ’–


okay that's the whole page!! this one's dated October 2012, and it's page MOSH(1) of the General Commands Manual. mwah, go connect to something πŸ’…βœ¨