- 1 1. Introduction: Why Use Remote Desktop with Ubuntu?
- 2 2. Comparing Remote Desktop Methods Available on Ubuntu [VNC vs RDP]
- 3 3. [Latest Version] How to Enable RDP (Remote Desktop) in Ubuntu 22.04
- 3.1 RDP Functionality is Standard in Ubuntu 22.04
- 3.2 Preparation and Checklist
- 3.3 How to Log In with an X.org Session
- 3.4 Steps to Enable Remote Desktop
- 3.5 Steps to Connect to Ubuntu from Windows
- 3.6 Firewall Settings (If Necessary)
- 3.7 Common Issues and Solutions
- 3.8 Note: Assumes Usage within a Local Network (LAN)
- 4 4. How to Connect Remotely Using xrdp on Ubuntu 20.04 and Earlier
- 5 5. Connecting Using VNC Servers (vino / tightvnc, etc.)
- 5.1 What is VNC? Remote Desktop Technology Available on Ubuntu
- 5.2 Major VNC Servers Available on Ubuntu
- 5.3 How to Use vino in the GNOME Environment (Ubuntu 20.04~22.04)
- 5.4 For CLI Use: tightvncserver
- 5.5 Security Note: Combination with SSH Tunnel is Recommended
- 5.6 Summary: VNC is Flexible but Requires Security Awareness
- 6 6. How to Connect to Ubuntu from Windows [Introducing Connection Clients]
- 6.1 Remote Operation of Ubuntu Requires Tools on the Connecting Side
- 6.2 When Using RDP: Windows Standard “Remote Desktop Connection”
- 6.3 When Using VNC: Use VNC Client Software
- 6.4 Remmina: Feature-rich Multi-protocol Client (Can Also Be Used on Ubuntu)
- 6.5 How to Check IP Address (On the Ubuntu Side)
- 6.6 Network Supplement
- 6.7 Summary: Choose a Client Based on Your Purpose
- 7 7. Troubleshooting Japanese Input and Keyboard Settings
- 7.1 The Problem of “Cannot Input Japanese” During Remote Connection
- 7.2 Cannot Input Japanese / IME Not Working
- 7.3 Half-width/Full-width Key Not Working, Key Mapping Shifts
- 7.4 Cannot Input Backslash (\) or Pipe (|)
- 7.5 Alternative Methods When Input Switching Doesn’t Respond
- 7.6 Last Resort When Japanese Input is Impossible: Use an Editor + Copy/Paste
- 7.7 Summary: Japanese Environment Behavior Varies by Connection Method
- 8 8. Secure Connection Methods [SSH Tunnel]
- 8.1 Remote Connection and Security Risks
- 8.2 What is an SSH Tunnel? Overview of the Mechanism
- 8.3 Preparation: Enabling SSH Connection
- 8.4 How to Create an SSH Tunnel from Windows (Example: Forwarding VNC Port 5901)
- 8.5 SSH Tunnel Can Also Be Used for RDP
- 8.6 Even More Secure with Public Key Authentication
- 8.7 SSH Tunnel Advantages and Disadvantages
- 8.8 Summary: SSH Tunnel is Essential for External Access
- 9 9. [FAQ] Frequently Asked Questions About Ubuntu Remote Desktop
- 9.1 Q1. What causes Ubuntu remote connection to fail?
- 9.2 Q2. What should I do if the screen is choppy or disconnects during connection?
- 9.3 Q3. Can I connect remotely from Ubuntu to Windows?
- 9.4 Q4. I want to connect to Ubuntu from outside my home or a different network.
- 9.5 Q5. I want to connect without entering a password every time.
- 9.6 Q6. Why can’t I input Japanese / why are the keys shifted?
- 9.7 Q7. Can I use remote connection for free?
- 9.8 Q8. Can multiple people operate Ubuntu simultaneously?
- 9.9 Q9. Ubuntu goes into sleep mode during remote operation.
- 9.10 Q10. Which is better, RDP or VNC?
- 10 10. Conclusion: Master Remote Connection on Ubuntu Easily and Securely
1. Introduction: Why Use Remote Desktop with Ubuntu?
Remote Control Scenarios for Ubuntu are Growing
Linux-based OSs, including Ubuntu, have traditionally been associated with developers and server administrators, with the assumption that they would be operated in a local environment. However, in recent years, with the expansion of remote work and the increasing use of Ubuntu as a learning PC, the need to “operate Ubuntu remotely” has grown.
For example, the scope of remote desktop usage is expanding, such as operating a home Ubuntu server from outside the house, or installing Ubuntu on an old laptop to use it as a terminal for remote development.
Differences from Windows? Ubuntu’s Unique Advantages
Some people might wonder, “Windows also has Remote Desktop, so is there any point in doing it with Ubuntu?” In fact, Ubuntu has the following characteristics that make it suitable for remote operation:
- It’s a lightweight and stable OS, allowing for comfortable operation even on low-spec PCs.
- It offers high security and is highly compatible with encrypted communication like SSH.
- It’s free and open-source, with no cost for use on multiple devices.
For these reasons, more people are choosing Ubuntu specifically for programming learning or server use and leveraging it remotely.
Becoming Easier to Use Even for Beginners Who Find it “Difficult”
Many people who are new to Linux-based OSs may feel uneasy, thinking, “Setting up remote connections seems difficult with all the commands.” Indeed, in the past, connecting remotely with Ubuntu required a certain level of knowledge, such as manual configuration of VNC servers or port forwarding via SSH.
However, since Ubuntu 22.04 LTS, remote connection via RDP (Remote Desktop Protocol) is supported by default and can be configured solely through the GUI. This increased ease of use for beginners has enabled more people to try leveraging Ubuntu remotely.
Purpose and Structure of This Article
In this article, we will explain how to achieve remote desktop connection using Ubuntu step-by-step, in a way that is easy for beginners to understand. We cover a wide range of topics, from how to utilize the latest features in Ubuntu 22.04, to setting up xrdp in older versions, and even methods for enhancing security using VNC and SSH tunnels.
We have structured the article to help you find the method that suits you best, comparing the characteristics and differences of each approach, so please read through to the end.
2. Comparing Remote Desktop Methods Available on Ubuntu [VNC vs RDP]
There are Multiple Protocols for Remote Connection
There isn’t just one way to achieve remote desktop with Ubuntu. Broadly speaking, the following three methods are common:
- RDP (Remote Desktop Protocol)
- VNC (Virtual Network Computing)
- SSH (Secure Shell) + X Forwarding or Tunneling
Among these, RDP and VNC are primarily used for general remote operations as they “transfer the entire desktop screen.” SSH, on the other hand, is mainly used for remote operation via the command line or as an auxiliary means for enhancing security.
Here, we will compare the characteristics and differences of RDP and VNC, which are particularly easy for beginners to handle.
What is RDP (Remote Desktop Protocol)?
RDP is a protocol originally developed by Microsoft and is widely used as a standard feature in Windows. In Ubuntu, it is possible to connect remotely using the RDP protocol by using software called xrdp.
Since Ubuntu 22.04 and later, the GNOME environment has RDP functionality built-in by default, so you don’t need to install xrdp separately; you can complete the remote connection setup using only the GUI.
Characteristics of RDP:
- High compatibility with Windows, allowing connections from the standard Windows Remote Desktop Connection tool.
- Fast and smooth screen rendering after connection.
- Authentication and encryption features are standard, making it relatively secure.
Recommended for:
- People who use a combination of Ubuntu and Windows.
- Beginners who want easy GUI configuration.
- People who prioritize security and stability.
What is VNC (Virtual Network Computing)?
VNC is a remote desktop technology that can be used cross-platform. In Ubuntu, it can be implemented using software like “vino” or “tightvncserver“.
The mechanism of VNC is slightly different from RDP; it uses a method of “sequentially transferring desktop images”, which tends to result in slightly slower rendering. On the other hand, its advantage is flexibility in features like session sharing (multiple people viewing the same screen simultaneously).
Characteristics of VNC:
- Can be used cross-platform (easy to connect from Mac and Android as well).
- Allows multiple users to share the same screen simultaneously.
- Security features are somewhat weak, so it is recommended to use it in combination with SSH.
Recommended for:
- When you want multiple people to operate Ubuntu remotely.
- When you want to connect from devices other than Windows.
- Intermediate to advanced users who want to customize settings in detail.
Comparison Table: Differences Between RDP and VNC
Item | RDP | VNC |
---|---|---|
Ease of Connection | ◎ (GUI setup, easy from Windows) | △ (Requires some initial setup effort) |
Rendering Comfort | ◎ (Smooth) | △ (Can be slightly choppy) |
Security | ◎ (Supports encryption by default) | △ (SSH tunnel recommended) |
Session Sharing | × | ○ (Multiple users can operate simultaneously) |
Supported Platforms | Windows-centric | Cross-platform (Linux, Mac, Android, etc.) |
Which One Should You Choose?
For beginners and Windows users, RDP is recommended. It is easy to set up and the connection is stable, making the barrier to entry low and ideal for getting started with Ubuntu remote connection.
On the other hand, if you require detailed configuration or want to connect from devices other than Windows, choosing VNC offers greater flexibility. However, when using VNC, it is important to implement security measures such as an SSH tunnel.
3. [Latest Version] How to Enable RDP (Remote Desktop) in Ubuntu 22.04
RDP Functionality is Standard in Ubuntu 22.04
Starting with Ubuntu 22.04 LTS, the default desktop environment (GNOME) now includes remote desktop functionality as a standard feature. This makes RDP connection easily available without the need to install external tools like xrdp.
Using this new feature, you can connect directly to Ubuntu from the standard Windows Remote Desktop client (mstsc.exe), making it very easy for beginners to use.
Preparation and Checklist
Before enabling RDP, please check the following points:
- Your Ubuntu version is 22.04 or later.
- You are using the GNOME desktop environment.
- You are logged in with an X.org session, not Wayland (Important).
The last point, “logged in with X.org instead of Wayland,” is particularly important for using the remote desktop feature. As Wayland currently does not support RDP connections, please change the session following the steps below.
How to Log In with an X.org Session
- On the Ubuntu login screen, select your username.
- Before entering your password, click the gear icon (⚙) in the bottom right corner.
- Select “Ubuntu on Xorg”.
- Enter your password and log in.
Steps to Enable Remote Desktop
- Open the “Settings” application.
- Select “Sharing” from the left-side menu.
- Click “Remote Desktop“.
- Toggle “Remote Desktop” to ON.
- Set the Authentication method to “Password” and enter a desired connection password.
- In the “Network” section, check “Enable remote connections for users on this network“.
This completes the setup on the Ubuntu side.
Steps to Connect to Ubuntu from Windows
- Press Windows Key + R, type “mstsc” and hit Enter (launches the Remote Desktop Connection tool).
- In the “Computer” field, enter the IP address of your Ubuntu machine.
- Upon connecting, a screen will appear asking for the username and password you set on Ubuntu.
- Connection complete.
You can find the IP address of your Ubuntu machine in “Settings” > “Wi-Fi” or “Wired”. Alternatively, you can use the following command in the terminal to check:
ip a
Firewall Settings (If Necessary)
If you have enabled Ubuntu’s UFW (Uncomplicated Firewall), you need to open the RDP port (default is TCP 3389).
sudo ufw allow 3389/tcp
After that, restart UFW or check its status:
sudo ufw status
Common Issues and Solutions
Problem | Solution |
---|---|
Screen is black after connecting | Check if you are logged in with X.org |
Connection is refused | Check the firewall and ensure you are on the same network |
No response after entering password | Check if Remote Desktop is enabled in GNOME Sharing settings |
Note: Assumes Usage within a Local Network (LAN)
This method is basically intended for use within the same network (LAN). If you want to connect from outside, you will need to set up VPN or port forwarding, or combine it with an SSH tunnel (which will be explained in a later chapter).
4. How to Connect Remotely Using xrdp on Ubuntu 20.04 and Earlier
Installing xrdp is Necessary for Ubuntu 20.04
Ubuntu 20.04 and earlier versions do not have the standard RDP functionality like Ubuntu 22.04. Therefore, if you want to connect remotely from Windows, you need to add RDP server functionality to the Ubuntu side using an external package called “xrdp”.
xrdp is compatible with Microsoft’s RDP protocol, making it easy to access Ubuntu from the standard Windows “Remote Desktop Connection” tool.
xrdp Installation and Basic Configuration
To install xrdp on Ubuntu 20.04, execute the following commands in the terminal:
sudo apt update
sudo apt install xrdp -y
Once the installation is complete, the xrdp
service will start automatically. To check the startup status, use the following command:
sudo systemctl status xrdp
If you see “active (running)” in green, it is operating normally.
Desktop Environment Selection (Xfce is Recommended)
Ubuntu’s default GNOME desktop is not very compatible with xrdp. There are many cases where sessions do not start correctly or a black screen is displayed.
Therefore, it is recommended to install the Xfce desktop environment, which is compatible with xrdp, and configure it to be used for sessions via xrdp.
Installing Xfce
sudo apt install xfce4 -y
Changing Session Settings
To change the session used by Xrdp to Xfce, create or edit the configuration file as follows:
echo "startxfce4" > ~/.xsession
Make sure to set appropriate permissions for the file:
chmod +x ~/.xsession
Furthermore, it may be necessary to adjust parts of the session configuration file to avoid polkit
-related permission errors, but for normal local use, the above steps are often sufficient.
Firewall Settings
xrdp uses port 3389/tcp. If you have enabled Ubuntu’s firewall (ufw), open the port with the following command:
sudo ufw allow 3389/tcp
How to Connect from Windows (Repeat)
- Press Windows Key + R → Run
mstsc
. - Enter the Ubuntu IP address in the “Computer” field.
- When the xrdp login screen appears, enter your Ubuntu username and password.
- Connection complete (the Xfce session will be displayed).
*The IP address can be confirmed on the Ubuntu machine using the ip a
or hostname -I
command.
Common Issues and Solutions
Symptom | Cause and Solution |
---|---|
Screen is black after connecting | Use Xfce instead of GNOME. Add startxfce4 to .xsession |
“Session ended” is displayed | Ubuntu and xrdp session management are not compatible. Confirm Xfce installation |
Connection drops after entering password | Possible cause: SELinux or polkit settings. Check security logs |
Automatic Startup/Restart Settings (Optional)
If you want the xrdp service to start automatically when the system boots, enable it with the following command:
sudo systemctl enable xrdp
5. Connecting Using VNC Servers (vino / tightvnc, etc.)
What is VNC? Remote Desktop Technology Available on Ubuntu
VNC (Virtual Network Computing) is a protocol for sharing screens over a network, characterized by its cross-platform availability on Windows, Linux, macOS, and more. By installing a VNC server on Ubuntu, you can connect remotely from other PCs, smartphones, etc.
Compared to RDP, VNC is slightly more complex to set up and has slower rendering speed, but it excels in terms of session sharing and connection destination flexibility. It is a particularly convenient option when you want multiple users to simultaneously view and operate the same desktop screen.
Major VNC Servers Available on Ubuntu
The following VNC servers are commonly used on Ubuntu:
Server Name | Features |
---|---|
vino | Integrated into the GNOME environment, setup is completed via GUI. Suitable for beginners. |
tightvncserver | Lightweight, fast, and has been used for a long time. Command-line centric. |
x11vnc | Can access the currently logged-in session. Ideal for GUI session sharing. |
How to Use vino in the GNOME Environment (Ubuntu 20.04~22.04)
GNOME has a built-in VNC server function called “vino” that can be easily configured from the GUI.
1. Install Necessary Packages (If not already installed)
sudo apt install vino -y
2. Enable Remote Control from “Settings”
- Open the “Settings” application.
- Select “Sharing” > “Screen Sharing”.
- Toggle “Screen Sharing” to ON.
- Enable “Allow connections to this computer”.
- Set up password authentication (strongly recommended for security).
*If GNOME is in a Wayland session, vino may not work correctly, so you need to log in with X.org (explained in Chapter 3).
3. Connection Test
Use a VNC client (e.g., RealVNC Viewer, TigerVNC) from another PC to connect to the Ubuntu IP address.
The address will be in a format like 192.168.1.100:5900
.
For CLI Use: tightvncserver
For server use, or if you want a lightweight installation without a GUI, tightvncserver
is a classic choice.
1. Installation
sudo apt install tightvncserver -y
2. Set Password on First Launch
vncserver
You will be prompted to enter a connection password the first time you run it.
3. Start VNC Session
vncserver :1
This will start a VNC session on port 5901
(5900 + display number).
4. Configure a Lightweight Desktop Environment like Xfce on Ubuntu (Optional)
Since tightvnc is not very compatible with GNOME, it is common to describe the following in the ~/.vnc/xstartup
file to launch with an Xfce session:
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
Give the script execution permissions:
chmod +x ~/.vnc/xstartup
Security Note: Combination with SSH Tunnel is Recommended
The VNC protocol does not encrypt communication content. Therefore, when using it outside the LAN or over the internet, it is strongly recommended to use it in combination with an SSH tunnel.
Example: Connect on the local PC as follows:
ssh -L 5901:localhost:5901 your-user@remote-ubuntu
After that, by connecting to localhost:5901
with a VNC viewer, you can communicate securely.
Summary: VNC is Flexible but Requires Security Awareness
VNC is excellent for Ubuntu remote connections in terms of flexibility and multi-platform support, but it is vulnerable if security measures are not taken. Especially when using it from an external network, we strongly recommend utilizing an SSH tunnel.
Also, depending on your purpose, you can choose a VNC server: vino for easy GUI-based use, tightvnc for lightweight/server use, and x11vnc if you want to share the currently logged-in session.
6. How to Connect to Ubuntu from Windows [Introducing Connection Clients]
Remote Operation of Ubuntu Requires Tools on the Connecting Side
Even if you have completed the remote desktop settings on the Ubuntu side, you still need a compatible client software on the connecting PC (usually Windows). Windows comes with a standard RDP client, but depending on your needs, you can also choose more feature-rich software.
This chapter will introduce the main methods for connecting to Ubuntu from Windows, explained simply by protocol.
When Using RDP: Windows Standard “Remote Desktop Connection”
If your Ubuntu machine supports RDP (either xrdp or GNOME’s standard RDP feature), you can access it using the “Remote Desktop Connection” application built into Windows.
Connection Steps
- Press Windows Key + R, type “mstsc” and press Enter.
- Enter the Ubuntu IP address (e.g., 192.168.1.10) in the “Computer” field.
- Click “Connect”.
- Enter the username and password and complete the connection.
Advantages
- No software installation required.
- Operation is fast and stable.
- Familiar UI for Windows users.
Notes
- Cannot be used if the target Ubuntu does not support RDP (older versions require xrdp setup).
- Assumes usage within a local network (VPN or SSH tunnel is needed for external connections).
When Using VNC: Use VNC Client Software
If a VNC server (vino, tightvnc, etc.) is installed on the Ubuntu side, you can also connect from Windows using a VNC viewer.
Recommended VNC Client Software
Software Name | Features |
---|---|
RealVNC Viewer | Supports both commercial and non-commercial use. Has a polished UI and is easy for beginners to use. |
TigerVNC Viewer | Open source. Simple in features but lightweight and fast in operation. |
TightVNC Viewer | A long-standing classic. Operates quickly with minimal features. |
Connection Steps (Using RealVNC as an Example)
- Install and launch RealVNC Viewer.
- Enter the connection destination, e.g.,
192.168.1.10:5900
(or 5901, etc.). - Click “Connect” and enter the VNC password.
- The Ubuntu screen will be displayed, and remote operation is possible.
Notes
- Communication is not encrypted, so it is necessary to combine with an SSH tunnel for secure use.
- Rendering smoothness is slightly inferior to RDP.
Remmina: Feature-rich Multi-protocol Client (Can Also Be Used on Ubuntu)
Remmina is a remote desktop client that can manage multiple connection methods such as RDP, VNC, and SSH in one application. Originally for Linux, a Windows version is also available, allowing for common operation on both platforms.
Features
- Unified management of RDP, VNC, and SSH connections in one app.
- Multi-functional features like saving connection profiles and scaling.
- Can also be used on the Ubuntu side, making it useful for connecting from Ubuntu to Windows as well.
Installation on Windows
- Can be used by downloading the installer from the official Remmina website (https://remmina.org).

How to Check IP Address (On the Ubuntu Side)
To connect from Windows, you need to know the local IP address of the Ubuntu machine. You can check it on Ubuntu using one of the following methods:
Checking via GUI
- Check detailed information from “Settings” > “Network” > “Wired” or “Wi-Fi”.
Checking in Terminal
ip a
Or
hostname -I
Use the address in the format 192.168.*.*
displayed by the above commands.
Network Supplement
It is assumed that the connecting machine and the target machine are on the same LAN. If you want to connect from a different network or from outside, you will need measures such as the following:
- Setting up a VPN (Virtual Private Network)
- Configuring port forwarding on your router (requires security considerations)
- Securing a safe route using an SSH tunnel (explained later)
Summary: Choose a Client Based on Your Purpose
Connection Method | Recommended Client | Primary Use Case |
---|---|---|
RDP | Windows standard “Remote Desktop Connection” | Easy and comfortable for Windows to Ubuntu connection |
VNC | RealVNC / TigerVNC / TightVNC | Want to share operation with multiple devices, or use on Mac/smartphone |
SSH | Remmina | Secure command-line and GUI combined connection |
Once the Ubuntu side is set up, choosing the optimal client based on your Windows environment will enable stress-free remote operation.
7. Troubleshooting Japanese Input and Keyboard Settings
The Problem of “Cannot Input Japanese” During Remote Connection
When operating Ubuntu remotely, you may encounter issues such as “cannot input Japanese,” “the half-width/full-width key doesn’t work,” or “cannot input backslash (\).” This happens because of differences in session environment due to remote connection, causing input settings to differ from local operation.
This chapter will detail common issues with Japanese input and the keyboard that can occur during remote connections with Ubuntu, and their solutions.
Cannot Input Japanese / IME Not Working
Main Causes
- Input method (IME) is not starting in the remote session.
- Input frameworks like fcitx or ibus are not cooperating well with each session.
- Compatibility issues between the GNOME session and RDP.
Solution 1: Explicitly Launch Mozc + fcitx
The common Japanese input environment on Ubuntu is the combination of “fcitx-mozc“. If this environment does not start automatically during a remote connection, you can often solve the problem by manually launching it using the following commands:
fcitx-autostart
Or
fcitx -r
Solution 2: Try Reconfiguring Input Methods for Each Session
- Check Settings > Region & Language > Input Sources.
- Confirm that “Japanese (Mozc)” is enabled.
- If not, click “+” to add Japanese input.
Changes may be reflected after logging out and logging back in, so try performing a logout and login.
Half-width/Full-width Key Not Working, Key Mapping Shifts
In remote desktop connections, the keyboard layout recognition can be inconsistent. Particularly due to the layout differences between Japanese (JIS) and English (US) keyboards, you often see problems where the positions of keys like “backslash (\)” or “@” change.
Solution: Explicitly Specify the Keyboard Layout
- Settings > Region & Language > Input Sources.
- Select “Japanese (Japanese)” or “Japanese (OADG 109A)”, etc.
- If necessary, apply the settings with the
setxkbmap
command:
setxkbmap -model jp106 -layout jp
You can add this setting to .xsession
or .bashrc
to apply it automatically upon remote login.
Cannot Input Backslash (\) or Pipe (|)
This issue, which is particularly common during RDP connections, is caused by xrdp not receiving key codes correctly.
Workaround: Force Keyboard Mapping Change
- Edit the following file:
sudo nano /etc/xrdp/km-0411.ini
- This file defines the mapping corresponding to a Japanese keyboard. You may need to manually correct the differences with an English layout if necessary (for advanced users).
A more practical method is to avoid this issue by using a protocol other than xrdp (such as VNC).
Alternative Methods When Input Switching Doesn’t Respond
If the half-width/full-width key is not working correctly, you can use alternative keys like the following to toggle Japanese input on/off:
For Mozc (fcitx):
Ctrl + Space
(Default)Shift + Space
(Changeable)
You can also change shortcut keys from the fcitx settings application.
Last Resort When Japanese Input is Impossible: Use an Editor + Copy/Paste
In environments where Japanese input is completely impossible, an effective temporary workaround is to type the text in Japanese on the local side (Windows), copy it, and paste it into an editor on Ubuntu.
Summary: Japanese Environment Behavior Varies by Connection Method
Symptom | Main Cause | Solution |
---|---|---|
Cannot input Japanese | IME not started, session mismatch | Restart fcitx-mozc, add input source |
Key layout is shifted | Keyboard layout mismatch | Explicit setting with setxkbmap |
Cannot input backslash | xrdp keymap issue | Modify km file, switch to using VNC |
In Ubuntu remote environments, keyboard input issues different from local operation are prone to occur. Therefore, it’s important to check settings and know alternative methods in advance.
8. Secure Connection Methods [SSH Tunnel]
Remote Connection and Security Risks
Ubuntu’s remote desktop features (RDP and VNC) are convenient, but exposing them directly to the internet is dangerous. If communication content is not encrypted or if access is possible with only password authentication, there is a risk of unauthorized access and eavesdropping by third parties.
As a countermeasure, using an SSH tunnel is widely recommended. An SSH tunnel creates a secure, encrypted “path (tunnel)” and routes communication like VNC or RDP through it, allowing safe access to Ubuntu even from outside.
[Windows] --(SSH encrypted)--> [Ubuntu]
|
+--> (Port forwarding for VNC or RDP internally)
What is an SSH Tunnel? Overview of the Mechanism
An SSH tunnel is a mechanism that uses the functionality of SSH (Secure Shell) connection to securely relay communication for other applications. This allows communication that is originally not encrypted, such as VNC or RDP, to be sent and received through an SSH-protected path.
Preparation: Enabling SSH Connection
If SSH is not installed on the Ubuntu side, install it with the following commands:
sudo apt update
sudo apt install openssh-server -y
After installation, sshd
will start automatically, but let’s check its status just in case:
sudo systemctl status ssh
If you have the firewall (UFW) enabled, allow the SSH port (22):
sudo ufw allow ssh
How to Create an SSH Tunnel from Windows (Example: Forwarding VNC Port 5901)
Method 1: Execute from Windows Terminal (PowerShell, etc.) using the ssh
command
ssh -L 5901:localhost:5901 your-user@ubuntu-ip
5901:localhost:5901
: Forwards local PC’s port 5901 to Ubuntu’s port 5901.your-user@ubuntu-ip
: Ubuntu username and IP address.
While keeping this command running, connect from your VNC client as follows:
localhost:5901
→ The communication will reach the Ubuntu VNC server via the SSH tunnel and the connection will be secure.
Method 2: Use SSH Clients like Tera Term or PuTTY (GUI)
- In Tera Term’s “TCP Port Forwarding” settings, specify the local and remote ports.
- This is convenient for those who want to manage settings via a GUI.
SSH Tunnel Can Also Be Used for RDP
Similarly, you can protect RDP connections (port 3389) with SSH.
ssh -L 3389:localhost:3389 your-user@ubuntu-ip
After that, access “localhost:3389” with Windows Remote Desktop Connection.
Even More Secure with Public Key Authentication
If you want to further enhance the security of SSH connections, you should implement the public key authentication method.
Steps (When creating keys on the Windows side):
- Execute the following command in PowerShell:
ssh-keygen
- Copy the generated public key to Ubuntu:
ssh-copy-id your-user@ubuntu-ip
*Alternatively, manually append it to ~/.ssh/authorized_keys
.
- Check the following in Ubuntu’s
/etc/ssh/sshd_config
:
PubkeyAuthentication yes
PasswordAuthentication no
Then, restart sshd
:
sudo systemctl restart ssh
SSH Tunnel Advantages and Disadvantages
Item | Description |
---|---|
✅ Advantage | Communication is encrypted, providing very high security. |
✅ Advantage | Avoids directly exposing RDP or VNC to the internet. |
❌ Disadvantage | Initial setup is somewhat complex and requires command-line operations each time. |
❌ Disadvantage | Connection is severed when the tunnel is closed (requires reconnecting). |
Summary: SSH Tunnel is Essential for External Access
When operating Ubuntu remotely, especially when accessing from outside your network or while traveling, a secure connection through an SSH tunnel is essential. Once you get used to it, it’s a very powerful method, and by combining it with other protocols like VNC or RDP, you can build a secure and comfortable remote environment.
9. [FAQ] Frequently Asked Questions About Ubuntu Remote Desktop
Q1. What causes Ubuntu remote connection to fail?
A. There are various causes, but checking the following points can help you find a solution.
- Is the IP address correct?
- Is Ubuntu connected to the same LAN?
- Is the firewall (UFW) blocking communication?
- Is the target Ubuntu logged in with an X.org session (for RDP)?
- Are xrdp or VNC running correctly?
First, check the status of each service in the terminal like this:
sudo systemctl status xrdp
sudo systemctl status ssh
Q2. What should I do if the screen is choppy or disconnects during connection?
A. This is mainly due to insufficient network bandwidth or differences in rendering methods. Here are some solutions:
- In RDP, setting to “low bandwidth mode” can improve performance.
- In VNC, using a lightweight desktop (e.g., Xfce) can help.
- Avoid heavy tasks like video or 3D graphics processing during remote connection.
- Using a wired LAN instead of wireless can improve stability.
Q3. Can I connect remotely from Ubuntu to Windows?
A. Yes, it is possible. Ubuntu has a feature-rich remote desktop client called Remmina, which can connect to the standard Windows RDP server (enabled in Pro version and above).
Steps to use Remmina on Ubuntu:
sudo apt install remmina -y
- Launch Remmina.
- Create a “New connection”.
- Select “RDP” as the protocol and enter the Windows IP and login information.
- Start the connection.
Q4. I want to connect to Ubuntu from outside my home or a different network.
A. To connect to Ubuntu from an external network, you need one of the following methods:
- Set up a VPN (Virtual Private Network).
- Use an SSH tunnel (explained in Chapter 8).
- Configure port forwarding on your router (not recommended).
Port forwarding is easy to set up but carries high security risks, so we recommend VPN or SSH tunnel.
Q5. I want to connect without entering a password every time.
A. For SSH connections, you can skip password entry by using public key authentication (also effective for improving security).
For RDP and VNC, some simplification is possible by setting up automatic login on the Ubuntu side, but handle this with caution as it increases security risks.
Q6. Why can’t I input Japanese / why are the keys shifted?
A. This is primarily due to input method startup failure or incorrect keyboard layout recognition.
Details are explained in Chapter 7, but the following steps are generally effective:
- Restart/initialize
fcitx
oribus
. - Explicitly set the layout using the
setxkbmap
command. - Check the GUI settings when using VNC.
Q7. Can I use remote connection for free?
A. Yes, Ubuntu, xrdp, Remmina, VNC, etc., are all open source and free. Some commercial features of VNC viewers (e.g., RealVNC) and VPN services have paid plans, but you can build a fully free environment for personal use.
Q8. Can multiple people operate Ubuntu simultaneously?
A. Typically, a standard RDP connection is one session per user.
With VNC, it is possible for multiple users to share the same screen. However, as operations may conflict, it is suitable for use in education or guidance.
Q9. Ubuntu goes into sleep mode during remote operation.
A. When Ubuntu enters sleep or suspend mode, the remote connection is interrupted. Take the following measures:
- Change the “Suspend” setting in “Settings” > “Power” to “Don’t suspend”.
- Detailed settings can also be changed with the
gsettings
command:
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
Q10. Which is better, RDP or VNC?
A. There is no definitive answer as to which is superior, but you can choose based on the following:
Priority | Recommendation |
---|---|
Connection comfort/rendering speed | RDP |
Shared operation by multiple users | VNC |
Compatibility with Windows users | RDP |
Security focus (assuming SSH combined) | Either is fine |
10. Conclusion: Master Remote Connection on Ubuntu Easily and Securely
Ubuntu Remote Desktop Isn’t Difficult
Perhaps some of you had the image that “Linux is difficult” or “remote connection is impossible without specialized knowledge.” However, through this article, it should have become clear that Ubuntu’s remote desktop connection is actually quite practical and accessible technology, even for beginners.
In Ubuntu 22.04 and later, standard RDP functionality is built-in, allowing setup with just GUI operations. Even in older versions, you can connect from Windows without issues using tools like xrdp and VNC.
Choose the Connection Method That Suits You
There are various ways to connect remotely to Ubuntu. Each has its advantages and disadvantages, and it is important to use them selectively depending on your environment and purpose.
Purpose | Recommended Connection Method | Comment |
---|---|---|
Easy connection within the home | RDP (Ubuntu standard or xrdp) | Easy and comfortable to use from Windows |
Secure connection from outside | RDP or VNC + SSH Tunnel | Build a secure encrypted path |
Sharing the same screen with multiple people | VNC (vino / x11vnc) | Convenient for collaborative work and educational settings |
CLI-centric management operation | SSH (Terminal connection) | Lightweight and robust remote management method |
Security Measures: That “First Small Effort” is Important
Along with convenience, remote connection also comes with security risks. Especially when exposing VNC or RDP over the internet, always combine them with an SSH tunnel or VPN, and review password authentication and firewall settings.
Also, implementing public key authentication for SSH can make daily connections both secure and smooth.
Trouble Happens, But There Are Solutions
As introduced in this article, issues like Japanese input, key mapping, connection failures, or black screens can occur, but there are established solutions for each. If you calmly check the cause one by one, most problems can be resolved on your own.
If you run into trouble, you can always come back to this page for a quick review.
Take the First Step
Once built, the Ubuntu remote desktop environment is a powerful tool that can significantly improve daily work efficiency. From remotely managing a home server to operating a development Ubuntu environment from a laptop, the possibilities are endless.
If you haven’t tried it yet, start with RDP connection within the same LAN. You’ll be surprised how easily new possibilities for Ubuntu can open up.
That concludes the Complete Guide to Ubuntu Remote Desktop Connection.
Thank you for reading!