Introduction
VNC, or Virtual Network Computing, is a simple method for sharing a graphical desktop environment. By installing VNC on your hosted server, you can connect to its graphical desktop environment remotely.
With VPS SELL, installing a VNC template is quick and easy. Follow these steps:
- Log in to the Client Area.
- Select "My Services > VPS" from the top menu.
- Click the "Manage" button in the service table.
- Click the "Install OS" button.
- Choose the operating system, agree to the warning, and click "Continue."
- Wait for 5-10 minutes and refresh the VPS management page.
1. VNC Server Configuration to Listen Only for Localhost Connections
To configure the VNC server to listen only for connections from localhost:
Open the VNC server configuration file:
- CentOS:
nano /etc/sysconfig/vncservers
- Ubuntu:
nano /etc/vncserver/vncservers.conf
Add -localhost
to the end of the VNCSERVERARGS
line, as shown below:
VNCSERVERARGS[1]="-geometry 1024x768 -localhost"
Restart the VNC service:
service vncserver restart
2. Connecting to the Server via SSH Tunnel (Linux Systems)
To establish an SSH tunnel, execute this command in the terminal of your Linux computer:
ssh -L 5901:localhost:5901 -N -f -l vncuser IP_of_the_server
Explanation of the command:
- -L 5901:localhost:5901: Forwards port 5901 on the local (client) host to port 5901 on the remote host.
- -N: Do not execute a remote command, just forward ports.
- -f: Requests SSH to go to the background just before command execution.
- -l vncuser: Specifies the username to log in as on the remote machine.
- IP_of_the_server: The IP address or hostname of your server.
Now you can connect to the server using VNC clients like TigerVNC or TightVNC, using localhost:5901
as the port.
3. Connecting to the Server via SSH Tunnel Using PuTTY (Windows Systems)
To set up an SSH tunnel using PuTTY:
- Open PuTTY.
- Under
Connection -> SSH -> Tunnels
, add:
- Source port: 5901
- Destination: localhost:5901
This will set up the SSH tunnel, allowing you to connect to the VNC server using localhost:5901
.
And connect to your server at its IP address and port 22 via PuTTY.
And then connect to localhost:5901 via a VNC viewer such as TightVNC TigerVNC, TightVNC and so on.