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 argumentnewmust be first on the command line to use command-line options.newis 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 theSSH_CONNECTIONenvironment 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 π-iIP β IP address of the local interface to bind (for multihomed hosts)-pPORT[:PORT2] β UDP port number or port-range to bind.-p 0will let the operating system pick an available UDP port. letting the OS choose? that's called delegating and it's a slay-cCOLORS β number of colors to advertise to applications throughTERM(e.g.8,256)-lNAME=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-serverwill 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 as604800(one week) or2592000(30 days). otherwise,mosh-serverwill wait indefinitely for a client to reappear. this variable is somewhat similar to theTMOUTvariable 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-serverwill ignoreSIGUSR1while waiting to receive an update from the client. otherwise,SIGUSR1will always terminatemosh-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 π β¨
π¦ where this page comes from
- alpine 3.22: mosh-server-doc 1.4.0-r14 Β· GPL-3.0-or-later
- alpine 3.23: mosh-server-doc 1.4.0-r18 Β· GPL-3.0-or-later
- alpine 3.24: mosh-server-doc 1.4.0-r18 Β· GPL-3.0-or-later
- arch rolling: mosh 1.4.0-35 Β· GPL-3.0-only
- debian bookworm: mosh 1.4.0-1+b1 Β· GPL-3.0-or-later WITH OpenSSL exception
- debian trixie: mosh 1.4.0-1+b2 Β· GPL-3.0-or-later WITH OpenSSL exception
- epel 10: mosh 1.4.0-7.el10_0 Β· GPL-3.0-or-later
- epel 9: mosh 1.4.0-1.el9 Β· GPLv3+
- fedora 43: mosh 1.4.0-9.fc43 Β· GPL-3.0-or-later
- fedora 44: mosh 1.4.0-10.fc44 Β· GPL-3.0-or-later
- nixos 26.05: mosh 1.4.0
- nixpkgs unstable: mosh 1.4.0
- opensuse-leap 16.0: mosh 1.4.0-bp160.1.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: mosh 1.4.0-bp160.1.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: mosh 1.4.0-bp160.1.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: mosh 1.4.0-bp160.1.1 Β· GPL-3.0-or-later
- ubuntu jammy: mosh 1.3.2-2.1ubuntu1 Β· GPL-3.0-or-later WITH OpenSSL exception
- ubuntu noble: mosh 1.4.0-1ubuntu3 Β· GPL-3.0-or-later WITH OpenSSL exception
- ubuntu questing: mosh 1.4.0-1ubuntu4
- ubuntu resolute: mosh 1.4.0-1ubuntu5 Β· GPL-3.0-or-later WITH OpenSSL exception
- ubuntu stonking: mosh 1.4.0-1ubuntu6 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms