Use SSH tunnel to access work PC apps from personal PC

Abstract: Use SSH local port forwarding to securely access work PC applications from a personal device without exposing the corporate network or configuring router NAT.

Created: 2026-08-30 by

Use the -L flag in your SSH client command to create a local port forward, mapping a local port on your personal PC to a specific service port on your work PC. This method encrypts traffic and bypasses most network restrictions without requiring complex router configurations or server-side daemon installations if you use standard remote desktop protocols.

Understanding the Local Port Forward Concept

When you need to access applications running on your work computer from your home device, you are essentially trying to bridge two separate networks. The most robust way to do this is through SSH tunneling, specifically using local port forwarding. Unlike remote desktop solutions that often require opening ports on your firewall or configuring NAT on your router, an SSH tunnel encapsulates your application's traffic inside an encrypted SSH connection. This approach has several advantages. First, it works even if your work PC is behind a strict corporate firewall that only allows outbound connections on port 22 (or 443). Second, it does not expose your work PC directly to the internet, significantly reducing the attack surface. Third, it requires minimal configuration on the server side, as long as the SSH client can reach the work machine. You might encounter articles discussing router port forwarding when searching for remote access solutions. However, those guides typically focus on exposing services publicly, which is unnecessary and risky for internal corporate resources. For a more secure alternative that avoids router complexity, consider reviewing Proxy Server Forwarding Traffic Over Two Consecutive Proxies to understand how traffic routing works at a higher level, though SSH tunnels operate differently by establishing a direct encrypted pipe rather than a multi-hop proxy chain.

Prerequisites and Assumptions

Before setting up the tunnel, ensure that your personal PC can reach your work PC over the network. If both devices are on the same LAN, you simply need the IP address of the work PC. If they are on different networks, you need a way to connect to the work PC, such as a static public IP, a dynamic DNS hostname, or a VPN connection provided by your employer. A common misconception is that the work PC must have an SSH server installed and running. While this is true for pure SSH tunneling, many modern operating systems include built-in remote management features. For example, Windows includes "Remote Desktop" (RDP) which can be tunneled over SSH. Linux distributions usually have OpenSSH server pre-installed or easily available. macOS also supports SSH out of the box. If you cannot enable SSH on the work PC due to IT policy restrictions, you may need to check connectivity issues first. A frequent error is the host being unreachable. See Connection to host xxxxxxxxxx at port 22 connection timed out for troubleshooting steps regarding firewalls and network paths.

Creating the SSH Tunnel

The core command for creating a local port forward is:
ssh -L [local_port]:[work_pc_ip_or_hostname]:[remote_port] user@work_pc_address
Here is how each component works:
  • -L: Specifies that this is a local port forward. It tells the SSH client to listen on your local machine.
  • [local_port]: The port number on your personal PC where you want to connect to access the remote service. You can choose any unused port above 1024.
  • [work_pc_ip_or_hostname]: The destination address within the remote network. This is relative to the SSH server (the work PC).
  • [remote_port]: The port on the work PC where the target application is listening (e.g., 3389 for RDP, 5900 for VNC, 80 for web apps).
  • user@work_pc_address: Your username and the address of the work PC reachable from your current location.
For example, to access a Windows Remote Desktop session on your work PC (IP: 192.168.1.50, port 3389) from your personal Mac, you would run:
ssh -L 5900:192.168.1.50:3389 [email protected]
This command creates a tunnel. Once connected, you will see a prompt on your terminal indicating the SSH session is active. Do not close this terminal window; the tunnel depends on this active connection.

Connecting to the Application

With the SSH tunnel established, your personal PC is now listening on localhost port 5900. Any traffic sent to this port is securely encrypted, sent through the SSH connection to the work PC, decrypted, and forwarded to 192.168.1.50:3389. Open your remote desktop client (such as Microsoft Remote Desktop, RealVNC, or a browser for web apps) and configure it to connect to: localhost:5900 (or whatever local port you chose). To the remote application, it appears as if you are sitting right next to the work PC. The encryption happens transparently between your client and the SSH server. It is important to note that this method only forwards one port at a time per SSH session unless you specify multiple -L flags. If you need to access multiple services, you can add them to the same command:
ssh -L 5900:192.168.1.50:3389 -L 8080:192.168.1.50:80 [email protected]
This allows simultaneous access to RDP on port 5900 and a web application on port 8080 via localhost.

Safety and Maintenance

Always remember that closing the SSH terminal disconnects the tunnel. If you leave the tunnel open while you step away, anyone with access to your personal PC could potentially exploit the open port if proper authentication isn't enforced on the remote service. Additionally, verify that your work PC’s firewall allows incoming connections from the SSH server itself. Since the traffic originates from the SSH daemon on the work PC, the firewall rule should permit local loopback or internal traffic, not necessarily external inbound traffic. For users who frequently switch between networks, consider using SSH config files to store these mappings permanently. This avoids typing long commands every time. Define a Host entry in ~/.ssh/config with the necessary LocalForward directives. If you experience latency, ensure that the SSH connection itself is stable. Sometimes, compressing the SSH stream helps with slow connections using the -C flag, although this adds CPU overhead.

Frequently Asked Questions

Can I use this method if my work PC is behind a NAT?

Yes, as long as your personal PC can initiate an outbound SSH connection to your work PC. NATs generally allow outbound connections but block inbound ones, so this tunneling method works perfectly because the work PC acts as the server initiating the data flow back to you through the encrypted channel.

Does this improve performance compared to standard RDP?

No, there is actually a slight overhead due to encryption and encapsulation. However, the difference is usually negligible for typical office tasks. The primary benefit is security and bypassing restrictive firewalls, not raw speed.

What if I get a "bind: Address already in use" error?

This means another process on your personal PC is already using the local port you specified. Choose a different local port number in your -L command, such as 5901 instead of 5900, and try again.

Is it safe to leave the SSH tunnel open overnight?

It is not recommended. Leaving tunnels open increases the risk of unauthorized access if your local machine is compromised. Always close the SSH session when you are done working to terminate the tunnel immediately.

How do I disconnect the tunnel?

You can disconnect by pressing Ctrl+C in the terminal where the SSH command was run, or by typing exit. This closes the SSH session and automatically removes the port forwarding rules on your local machine.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More