Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Install and Use Mosh on a VPS

A complete Mosh VPS setup guide: install the client and server, verify SSH, open the correct UDP range, use custom SSH ports, and troubleshoot hangs.
Length9 min Posted Quest giverVGSources Team
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, confirm that ordinary SSH works, then connect with mosh user@host. SSH still performs authentication and starts mosh-server; after that hand-off, your terminal uses an encrypted UDP connection. Allow UDP ports 60000–61000 in every firewall between the client and VPS, or select a smaller range with -p.

Mosh is designed for interactive shells that must survive Wi-Fi changes, laptop sleep and temporary connectivity loss. It is not a replacement for SSH port forwarding, X forwarding or sshfs; keep a normal SSH command available for those tasks.

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 you need before installing Mosh

Mosh has a client/server design. The mosh program runs on your computer, while a matching mosh-server helper is started on the VPS for each session. Install the package in both places. Installing it only on the VPS, or only on your laptop, leaves the connection incomplete.

  • A user account on the VPS with permission to log in over SSH.
  • The same SSH authentication method you already use successfully, such as a password or public key.
  • A working ordinary SSH connection before you attempt Mosh.
  • Permission to change the VPS host firewall and the cloud provider’s firewall or security group.
  • A network path that permits outbound and return UDP traffic. If the VPS is behind NAT, access to its selected UDP ports must be forwarded.

Mosh expects a UTF-8 locale for reliable character display. If accented characters, box-drawing characters or other non-ASCII text render incorrectly, check the locale on both ends before diagnosing the network.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Install Mosh on the VPS

Ubuntu and Debian

On an Ubuntu or Debian VPS, update the package index and install Mosh:

sudo apt-get update
sudo apt-get install mosh

The package installs the client and the server helper. The helper is not a system daemon: it runs as the unprivileged remote user for the lifetime of a Mosh connection and exits when that connection ends. It does not require root privileges at session time.

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

Other Linux and BSD systems

Package names and commands vary by operating system. The Mosh project’s installation page lists commands for distributions using dnf, apk and pacman, as well as Homebrew, MacPorts, FreeBSD, OpenBSD and other platforms. Use the package manager appropriate to the operating system on your VPS and install Mosh on the local client with the corresponding platform package as well.

Do not copy an Ubuntu command to another distribution without checking its package manager. After installation, verify that the binary is available to the remote account with:

mosh-server --help

A help screen or version output confirms that the server helper can be found. If the shell reports “command not found,” install the package for that operating system or place the binary in the user’s PATH.

Install Mosh on your local computer

Install the Mosh client on the computer from which you will connect. Use the package method for that operating system; the VPS installation does not provide a client automatically. A common mistake is to test ssh from a workstation that has no mosh executable, then assume the VPS package failed.

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

Once installed, check the local command before connecting:

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
mosh --help

Keep the regular SSH client installed too. Mosh invokes SSH as its authentication and launch channel, so removing or misconfiguring SSH prevents Mosh from starting even when UDP is open.

Verify SSH first

Use the exact account, hostname, key and SSH port that you intend to use with Mosh:

ssh [email protected]

Log in, run a simple command, and exit. Resolve failures at this stage first: an incorrect username, key, password, DNS name, host key or TCP firewall rule is an SSH problem, not a Mosh problem. Mosh presents the same credentials you use with SSH, including a password or public key, and does not create a separate authentication system.

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

If SSH uses a non-standard TCP port, test it explicitly:

ssh -p 2222 [email protected]

Only after this command succeeds should you configure the equivalent Mosh command.

Open the UDP ports Mosh uses

After SSH starts the server helper, Mosh normally selects one UDP port in the range 60000–61000. Permit that range in both firewall layers commonly present on a VPS:

  1. The operating system’s firewall on the VPS, such as the rules managed by your distribution’s firewall tools.
  2. The provider’s cloud firewall, security group or network access list.

Allow UDP, not only TCP. The SSH connection can succeed while Mosh still fails because SSH uses TCP and the persistent Mosh session uses UDP.

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.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Use a narrower range when appropriate

You can constrain the server-side selection with a range such as 60000–60010:

mosh -p 60000:60010 [email protected]

A ten-port range reduces the number of exposed ports for a small number of concurrent sessions, but every simultaneous Mosh session needs an available port. Coordinate the same range with the VPS firewall, the cloud firewall and any NAT forwarding. The -p option changes the Mosh UDP range; it does not change the SSH TCP port.

NAT and multiple addresses

If the VPS is behind NAT, forward the selected UDP range to the VPS in addition to forwarding its SSH TCP port. Confirm that the address advertised to the client is the VPS’s reachable public address, not an internal address. A multihomed server or proxy can require an explicit bind choice; in that case, use --bind-server=any or provide the address on which the helper should bind. Change this only when the normal bind behavior does not match your network topology.

Connect with Mosh

With both packages installed, SSH verified and UDP permitted, start an interactive session:

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

Mosh first launches SSH. SSH authenticates you and starts an unprivileged mosh-server process on the VPS. The server chooses a high UDP port and sends the connection details through the SSH channel. The client then switches to an encrypted, long-lived UDP datagram connection for the terminal.

You should receive the remote shell prompt as you would with SSH. Type a command, suspend or close the laptop briefly, reconnect through another network if available, and continue using the same terminal. Mosh is built to keep interactive state while the client’s IP address changes or packets are temporarily lost.

Use a non-standard SSH port

Mosh accepts SSH options through the --ssh argument. If SSH listens on TCP port 2222, run:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
mosh --ssh="ssh -p 2222" [email protected]

The quoted value is the SSH command Mosh uses to authenticate and launch the server. The Mosh UDP port remains in the normal 60000–61000 range unless you also set -p:

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

This command requires TCP 2222 to be reachable for the initial login and UDP 60000–60010 to be reachable for the resulting session. Changing one does not change the other.

Understand the SSH-to-UDP hand-off

What SSH does

SSH is the bootstrap and authentication mechanism. Mosh reuses the credentials and account permissions that already work with SSH, then asks SSH to execute the server helper. This means SSH host-key checking, key agents, passwords and account restrictions remain relevant at startup.

What Mosh does after login

The client and helper maintain an encrypted UDP datagram connection designed for an interactive terminal. UDP avoids tying the session to one TCP connection, allowing Mosh to tolerate intermittent connectivity and roaming between networks. The server helper is not a background service that stays running after logout; it exists for the connection lifetime and exits when the client disconnects.

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

The initial wait window

By default, mosh-server waits up to 60 seconds for the client to connect after it has been started. A message about the server starting followed by a timeout usually means the SSH launch worked but the UDP path did not become usable during that window.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot “SSH works but Mosh hangs”

“Nothing received from the server on UDP port 60003”

This message means Mosh started mosh-server, but the client did not receive traffic on the selected UDP port. The usual causes are blocked UDP traffic or missing NAT forwarding. Work through both firewall layers rather than changing SSH credentials first.

  1. Confirm the exact UDP port shown in the error and allow it, or allow the entire configured range.
  2. Check the VPS host firewall for an inbound UDP rule covering that port.
  3. Check the provider’s cloud firewall or security group for the same UDP rule.
  4. If the VPS is behind NAT, forward the port or selected range to the VPS’s private address.
  5. Verify that the hostname resolves to the public address that actually routes to the VPS.
  6. Retry with a narrow, known-open range using -p and update every firewall and forwarding rule to match.

Do not test only TCP connectivity: a successful SSH login proves the TCP path, not the UDP path Mosh requires.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Inspect traffic when rules look correct

For a stubborn case, inspect whether packets reach the VPS. Depending on what is installed on the system, useful tools include netstat, nc (netcat), socat and tcpdump. Capture on the interface and port selected by Mosh while starting a new session. Seeing packets arrive but no response points to a local firewall or bind-address issue; seeing no packets points to the cloud firewall, NAT, routing or the client’s network.

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.

Server binary is not in PATH

If the helper exists but is outside the remote user’s executable path, tell Mosh where it is:

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

Use the actual absolute path on the VPS and ensure the file is executable by the remote account. This option affects the server helper location, not the SSH command or UDP range.

Multihomed or proxy deployments

A VPS with several interfaces, a proxy, or unusual routing may need a different bind behavior. Try --bind-server=any only when the default address selection is wrong, or provide an explicit address that the client can reach. Opening ports on an address that is not advertised or routed will not fix the session.

Terminal characters look wrong

Mosh expects UTF-8 locale settings for dependable character display. Check the locale reported by the remote shell and the locale configured on the client. Correct the locale configuration and reconnect rather than treating garbled text as a UDP failure.

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

Mosh compared with ordinary SSH

Area Mosh Ordinary SSH
Authentication Uses SSH credentials and SSH to launch the server helper. Authenticates directly over its TCP connection.
Interactive response Designed for immediate local response while typing, deleting and editing lines, even on high-latency links. Interactive input follows the SSH TCP connection and can feel sluggish when latency or packet loss is high.
Sleep, roaming and short outages Designed to preserve an interactive session through intermittent connectivity and client IP changes. A broken TCP path normally requires reconnecting or using another persistence layer.
Firewall requirements Needs SSH for startup plus reachable UDP in the selected range, normally 60000–61000. Needs the configured SSH TCP port.
Port forwarding and sshfs Not supported. Supported by SSH features and clients.
Server process An unprivileged helper runs for the connection lifetime and then exits. The SSH daemon remains a system service and handles each session.

Choose Mosh for a shell you actively type in while moving between networks or dealing with unreliable links. Choose ordinary SSH when you need local or remote port forwarding, X forwarding, sshfs or another non-interactive workflow. It is normal to use both tools on the same VPS.

Practical connection patterns

Default ports and a standard user

mosh [email protected]

Use this when SSH listens on its standard TCP port and UDP 60000–61000 is allowed.

Custom SSH and constrained UDP

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

Use this when the SSH daemon listens on TCP 2222 and your firewall policy permits only UDP 60000–60010.

Server helper in a custom location

mosh --server=/opt/mosh/bin/mosh-server [email protected]

Replace the path with the executable location on the VPS. The remote user must be able to execute it.

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

Security and operations checklist

  • Keep SSH authentication configured and tested; Mosh does not bypass SSH access controls.
  • Permit UDP only on the range you actually use. The default is 60000–61000; a smaller range is possible with -p.
  • Apply matching rules at the VPS firewall, cloud firewall and NAT device.
  • Do not assume a successful TCP port test proves Mosh will work.
  • Remember that each active session needs a free UDP port inside the selected range.
  • Use ordinary SSH for forwarding, X applications or sshfs.
  • Keep the SSH command available as a recovery path when a client network blocks UDP.

Quick setup sequence

  1. Install Mosh on the VPS and local computer.
  2. Run ordinary SSH with the intended username, hostname, key and port.
  3. Allow UDP 60000–61000 in the VPS and cloud firewalls, or choose and allow a narrower range.
  4. Configure NAT forwarding if the VPS is not directly reachable from the internet.
  5. Connect with mosh user@host.
  6. For a custom SSH port, use mosh --ssh="ssh -p 2222" user@host.
  7. If the session hangs, inspect the selected UDP port and both firewall layers before changing credentials.

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.