Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Install and Use Mosh on a VPS

A practical guide to installing Mosh on Ubuntu or Debian VPS hosts and local clients, opening the required UDP range, using non-standard SSH ports, and fixing common connection failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Mosh on both your local computer and the VPS, verify that ordinary SSH works, allow the VPS to receive Mosh’s UDP traffic, and then connect with mosh user@host. SSH is used only to authenticate and start mosh-server; your interactive terminal then runs over an encrypted, long-lived UDP connection. That design keeps typing responsive and lets a session survive temporary network loss, sleep, or a change of client IP address.

Mosh is not a replacement for every SSH feature. Keep SSH for port forwarding, X forwarding, sshfs, and other workflows that depend on an SSH transport rather than an interactive terminal.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Mosh does on a VPS

Mosh (the mobile shell) combines SSH authentication with a separate UDP transport. When you run a Mosh command, the client first makes a normal SSH connection to the VPS using the same password, public key, agent, or other credentials you already use. SSH starts an unprivileged mosh-server process for your account. The server selects a high UDP port and sends the connection details back through SSH. The client then switches the terminal session to an encrypted UDP datagram connection.

Because the terminal protocol is stateful and the client keeps track of what the screen should look like, Mosh can acknowledge local editing quickly and repair the display after packets are delayed or lost. It is designed for interactive shells over unreliable links, including a laptop moving between networks or waking from sleep. The server helper is not a system daemon, does not need root privileges, and normally exits when the client disconnects.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

The trade-off is networking and feature scope: UDP must reach the selected server port, and Mosh does not provide SSH’s X forwarding, SSH port forwarding, or sshfs support.

Before you install: requirements and a safe test

  • You need a user account on the VPS and a working SSH login.
  • You need administrative access (normally sudo) to install the VPS package and change its host firewall.
  • Mosh must be installed on both ends: the computer from which you connect and the VPS itself.
  • The VPS must be reachable through its public address, and any provider-level firewall or security group must permit the Mosh UDP range you choose.
  • If the VPS is behind NAT, the selected UDP ports must be forwarded to the VPS in addition to the SSH TCP port.
  • UTF-8 locale settings are expected for reliable character display.

First prove that SSH works independently:

ssh [email protected]

Do not troubleshoot Mosh until this command succeeds. Mosh reuses SSH’s credentials and uses that SSH connection to launch the server; it cannot repair an SSH authentication, DNS, routing, or account problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Mosh on an Ubuntu or Debian VPS

Update package metadata

On an Ubuntu or Debian server, refresh the package index:

sudo apt-get update

Install the package

Install Mosh on the VPS itself:

sudo apt-get install mosh

The package supplies the remote mosh-server helper as well as the client command. Installing it on the server does not install anything on your laptop or workstation; the local client needs its own installation.

Install the local client

Install Mosh through the package manager for your client operating system. The project’s installation instructions cover Linux package managers such as dnf, apk, and pacman, as well as Homebrew, MacPorts, FreeBSD, OpenBSD, and other systems. Use the package name mosh where your platform provides it, then verify that the command is available:

mosh --version

If your platform’s package manager installs the client in a directory that is not in your shell’s PATH, add that directory before connecting. The remote account must likewise be able to find mosh-server; a later section explains the override for non-standard locations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Open the UDP path

Understand the two transports

SSH authentication and server startup use the SSH TCP port (normally TCP 22, or whatever custom port you configured). The persistent Mosh session uses UDP instead. Opening TCP 22 alone therefore allows SSH but leaves Mosh unable to carry terminal traffic.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Default port range

By default, Mosh chooses one UDP port from 60000 through 61000. Permit that UDP range in every firewall layer between the client and VPS:

  • The VPS operating-system firewall, if one is enabled.
  • The hosting provider’s cloud firewall, security group, or network access list.
  • Your own router or NAT device, when the VPS is not directly assigned the public address.

For a host firewall that accepts a range, create an inbound UDP rule covering 60000–61000 and apply it to the VPS’s public interface. Keep the existing SSH TCP rule; the UDP rule is additional, not a replacement.

Use a smaller range when appropriate

You can constrain server-side port selection with a range or a single port:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mosh -p 60000:60010 [email protected]

The -p value controls the UDP port range from which mosh-server chooses. It does not change the SSH port. Open the same narrowed range in both the VPS firewall and the provider firewall. A range such as 60000–60010 exposes fewer possible ports, but it also limits how many simultaneous Mosh sessions can obtain distinct ports; choose enough ports for the users and sessions that will run concurrently.

NAT and public addresses

When the VPS is behind NAT, forward the UDP range you configured to the VPS’s private address, and forward the SSH TCP port separately. Also confirm that the address advertised to the client is the VPS’s reachable public address. A server can start successfully while still being unreachable if the returned address points to an internal interface or an unforwarded path.

Make your first Mosh connection

Standard SSH port

With Mosh installed locally and remotely and the UDP rule active, connect as follows:

mosh [email protected]

You should see the normal SSH authentication prompts first. After authentication, the client starts the remote helper and changes to the UDP session. Test an interactive command such as uname -a, type several lines, then briefly suspend or change networks to confirm that the terminal recovers without starting a new shell.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Non-standard SSH port

If SSH listens on another TCP port, pass an SSH command explicitly:

mosh --ssh="ssh -p 2222" [email protected]

This tells Mosh to invoke SSH on TCP 2222 for authentication and server startup. It does not make UDP use port 2222; the Mosh UDP port is still selected from the default range or from your -p setting. If you use additional SSH options, include them inside the quoted command, for example a different identity file or jump-host option supported by your SSH client.

Constrain both settings deliberately

A connection using a custom SSH port and a narrow UDP range combines both options:

mosh --ssh="ssh -p 2222" -p 60000:60010 [email protected]

Remember that the quoted SSH command governs only the initial TCP connection. The firewall still needs to allow the UDP range selected by -p.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the startup sequence works

  1. The Mosh client launches your specified SSH command.
  2. SSH authenticates you with the credentials already accepted by the VPS.
  3. SSH starts mosh-server under your user account; the helper does not require root.
  4. The server chooses a high UDP port and reports the connection information over SSH.
  5. The client opens an encrypted UDP datagram session and maintains terminal state independently of a single TCP connection.
  6. When the client exits, the helper ends with the connection rather than remaining as a permanent daemon.

A newly started server waits up to 60 seconds for its client. If UDP is blocked or the client never completes the hand-off, the helper can disappear after that interval; restarting the Mosh command starts a fresh helper.

Troubleshoot “SSH works but Mosh hangs”

Interpret the diagnostic message

A message such as Nothing received from the server on UDP port 60003 means that SSH succeeded and mosh-server started, but the client did not receive UDP traffic from the selected port. Treat this as a UDP reachability problem rather than an authentication failure.

Check both firewall layers

  1. Inspect the VPS host firewall and confirm an inbound UDP rule for the configured range (the default is 60000–61000).
  2. Inspect the provider’s cloud firewall or security group and add the same UDP allowance there.
  3. If NAT is present, verify that the selected range is forwarded to the VPS’s private address.
  4. Confirm that the hostname resolves to the VPS’s public address and that the address is the one reachable from your current network.
  5. If you used -p, verify that every rule matches that exact range rather than the default.

Verify that the remote helper exists

SSH to the VPS and check that the binary is installed and discoverable:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
command -v mosh-server

If this prints no path, install the package on the VPS or provide the actual location from the client:

mosh --server=/path/to/mosh-server [email protected]

The --server option changes the remote helper path; it does not alter firewall rules or the SSH command.

Inspect the selected port on the server

During a failed attempt, use available diagnostic tools on the VPS, such as netstat, to see whether the helper is listening. From another machine, nc (netcat) or socat can help test UDP behavior. A packet capture with tcpdump can show whether datagrams arrive at the VPS and whether replies leave it. These tools cannot prove that an arbitrary UDP probe is a valid Mosh handshake, but they can distinguish a missing route or firewall rule from a client-side failure.

Allow enough time for the hand-off

Because the helper’s initial wait is limited to 60 seconds, do not leave a failed attempt idle while changing firewall rules. Apply the rule, start a new Mosh command, and observe the new selected port.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Multihomed hosts and unusual network layouts

A VPS with several interfaces, a proxy, or a non-standard routing arrangement may need an explicit bind behavior. Mosh can be instructed to bind the server to any address:

mosh --bind-server=any [email protected]

You can also provide an explicit address when the server must listen on a particular interface. Use this only when the normal selection is wrong; binding to an address that is not reachable from the client will make the session fail even though the helper starts.

Mosh versus ordinary SSH

Both tools use your SSH credentials for the initial login, but they solve different problems.

Capability Ordinary SSH Mosh
Authentication Direct SSH authentication SSH authenticates and launches mosh-server
Interactive typing Interactive terminal over a TCP connection Interactive terminal with local responsiveness and state synchronization
Sleep, roaming, intermittent links A broken TCP path normally requires reconnecting Designed to resume after temporary loss and client IP changes
Firewall requirement SSH TCP port SSH TCP port plus a reachable UDP port range
Port forwarding Supported Not supported
X forwarding Supported when configured Not supported
sshfs Supported through SSH Not supported
Server privileges Uses the permissions of the logged-in account mosh-server runs unprivileged under the logged-in account

Choose Mosh for a shell, editor, REPL, or administration session that must remain usable while the network changes. Choose ordinary SSH when the task depends on forwarding a port, mounting a remote filesystem, forwarding X, or carrying another non-interactive protocol.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational details that prevent surprises

Locale and character display

Mosh expects UTF-8 locale settings for reliable character display. If accented characters, box-drawing characters, or other Unicode text render incorrectly, compare the locale reported by your local terminal and the remote shell, and configure both sides for a UTF-8 locale supported by the VPS.

Session lifetime

The Mosh server helper exists for the connection lifetime. It is not a background service that you manage with a system service manager. A disconnected client can reconnect according to Mosh’s protocol while the session remains available, but ending the session terminates the helper and its shell.

Port planning for multiple users

Every concurrent Mosh session needs a selectable UDP port. A narrow range reduces firewall exposure but leaves less room for simultaneous sessions. If users regularly connect from several devices, use a range large enough for the expected concurrency and mirror it exactly in all firewall and NAT rules.

A repeatable setup checklist

  • SSH login to the VPS succeeds with the intended account.
  • Mosh is installed on the local client.
  • Mosh is installed on the VPS and mosh-server is in the remote user’s PATH, or you have its full path.
  • The SSH TCP port is open and, if non-standard, is supplied through --ssh="ssh -p PORT".
  • The selected UDP range is open in the VPS firewall and provider firewall.
  • NAT forwards the selected UDP range when the VPS is not directly public.
  • The VPS advertises a reachable public address.
  • The client and server use UTF-8 locales.
  • You have reserved ordinary SSH for forwarding, sshfs, X forwarding, and other features Mosh does not implement.

Common mistakes and their fixes

Installing only on the VPS

The remote package alone is insufficient. Install the client locally as well; the command you type is executed by your local Mosh binary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Opening only the SSH port

SSH can authenticate successfully while Mosh remains stuck because terminal traffic moves to UDP. Add the configured UDP range at both the host and provider layers.

Assuming -p changes SSH

-p selects the server-side Mosh UDP range. For an SSH port such as 2222, use --ssh="ssh -p 2222" separately.

Using Mosh for file mounts or tunnels

Mosh does not implement sshfs, X forwarding, or SSH port forwarding. Start an ordinary SSH connection for those functions, even if you use Mosh for your interactive shell.

Leaving the remote helper outside PATH

Install the package in a standard location or point Mosh to the binary with --server=/path/to/mosh-server. The path must be executable by the remote account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick command reference

Purpose Command
Install on Ubuntu or Debian VPS sudo apt-get update && sudo apt-get install mosh
Verify local client mosh --version
Basic connection mosh [email protected]
SSH on TCP 2222 mosh --ssh="ssh -p 2222" [email protected]
UDP range 60000–60010 mosh -p 60000:60010 [email protected]
Custom helper path mosh --server=/path/to/mosh-server [email protected]
Bind server to any interface mosh --bind-server=any [email protected]

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.