Your company here — click to reach over 10,000 unique daily visitors

mosh-server - Man Page

server-side helper for mosh


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


mosh-server is a helper program for the mosh(1) remote terminal application.

mosh-server binds to a high UDP port and chooses an encryption key to protect the session. It prints both on standard output, detaches from the terminal, and waits for the mosh-client to establish a connection. It will exit if no client has contacted it within 60 seconds.

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

On platforms with utempter, mosh-server maintains an entry in the utmp(5) file to indicate its process ID, whether the session is connected, and the client's current IP address.

mosh-server exits when the client terminates the connection.


The argument "new" must be first on the command line to use command-line options.


bind to the local interface used for an incoming SSH connection, given in the SSH_CONNECTION environment variable (for multihomed hosts)


Print some debugging information even after detaching.  More instances of this flag will result in more debugging information.

-i IP

IP address of the local interface to bind (for multihomed hosts)


UDP port number or port-range to bind.  -p 0 will let the operating system pick an available UDP port.


Number of colors to advertise to applications through TERM (e.g. 8, 256)


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. They may be set by administrators in system login/rc files, /etc/login.conf, or similar mechanisms, or 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.


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.  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.


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.


$ mosh-server


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

[mosh-server detached, pid = 20443]

See Also

mosh(1), mosh-client(1).

Project home page: https://mosh.org


mosh was written by Keith Winstein <mosh-devel@mit.edu>.


Please report bugs to mosh-devel@mit.edu. Users may also subscribe to the mosh-users@mit.edu mailing list, at

Referenced By

mosh(1), mosh-client(1).

October 2012