Skip to content

Instantly share code, notes, and snippets.

@Fartomy
Last active April 2, 2024 19:09
Show Gist options
  • Save Fartomy/e11a589f230cc7efc4177b93e1b70efb to your computer and use it in GitHub Desktop.
Save Fartomy/e11a589f230cc7efc4177b93e1b70efb to your computer and use it in GitHub Desktop.
Abundance of Servers

🥗 Abundance of Servers

May be nice to remote connect to PC on browser. With noVNC.

But we need a lot servers:

to Debian based

Setup

  1. Install the required packages
sudo apt install xfce4 xfce4-goodies tightvncserver novnc websockify python3-numpy -y
  1. Create VNC server and set to password
vncserver

But kill the X server because we don't need for now

vncserver -kill :1
  1. Configure to xstartup file
# mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
# nano ~/.vnc/xstartup
  1. Added these lines into file
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &

Grant all permission to xstartup file

chmod +x ~/.vnc/xstartup
  1. Create a VNC server again
vncserver
  1. Create a .pem file by openssl for securtiy
cd /etc/ssl; openssl req -x509 -nodes -newkey rsa:2048 -keyout novnc.pem -out novnc.pem -days 365

Give the requires permissions for .pem file

chmod 644 novnc.pem
  1. start to websockify server and access to VNC server
websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 6080 localhost:5901
  1. learn IP address
ip a
  1. Connect to server from your browser by this URL
https://<ip_adress>:6080/vnc.html
  1. You can also access using this IP from a different PC device.

What is?

VNC Server

A VNC server with TightVNC makes a computer's display and input devices (keyboard and mouse) accessible remotely, so you can remotely connect and view and control the computer's display using a VNC client (noVNC).

X Server

The VNC (Virtual Network Computing) server creates an X Server. However, this X Server usually does not operate directly on a physical monitor connected to the computer; instead, it is used to provide remote access to a client over a network.

By creating an X Server, the VNC server enables the user's computer desktop environment to be accessed remotely. This allows another computer or device to view the user's computer screen and make mouse/keyboard inputs using a VNC client (noVNC).

The "X desktop" (X desktop) created by the VNC server is essentially an X Server session. This session generates user interface elements (windows, menus, buttons, etc.) and allows remote access from a distant device. Thus, the VNC server provides the user with a desktop environment on the X Server that is accessible remotely.

Websockify Server

Websockify is necessary to connect to a VNC server because VNC servers typically do not directly support the WebSocket protocol. However, modern web browsers often support the WebSocket protocol. Therefore, Websockify serves as a tool to provide access to VNC servers via modern web browsers.

Websockify initiates a WebSocket server and listens for incoming WebSocket connections. It converts these connections into a format understandable by the VNC server and forwards them to the VNC server. This allows access to the VNC server through modern web browsers.

In summary, Websockify is required to connect to a VNC server through web browsers because VNC servers do not usually support the WebSocket protocol directly. By bridging this communication gap, Websockify facilitates communication between web browsers and VNC servers.

xstartup File

The xstartup file is a script file associated with starting the VNC server. This file is run upon starting the VNC server and is used to configure the users' session. Specifically, the xstartup file is used to specify the desktop environment, window manager, and other elements that will run in the users' session.

When the VNC server starts, the xstartup file is run for a specific user. The commands in the file define the actions to be performed when starting this user's VNC session. For example, the xstartup file can start a desktop environment (for example, GNOME, KDE, XFCE) or apply custom user-specified settings.

noVNC

noVNC is a web-based VNC client that provides access to a VNC server via Websockify. So, noVNC is used to connect to a VNC server via a web browser. It provides access to the VNC server using WebSocket connections created by Websockify, allowing the user to view and control a remote computer's display and input devices.

Sources

  1. installing noVNC On Ubuntu 20.04 LTS Desktop
  2. How To install noVNC Client On Ubuntu 18.04 LTS Bionic Beaver
  3. Computer on browser
  4. How To Setup Kali In The Browser noVNC
  5. Use web browser to connect Linux VNC server(tigervnc+novnc)
  6. NoVNC installation tutorial on Windows
  7. NoVNC on Windows, Linux and MacOS
  8. noVNC Tutorial (Windows)
  9. Stop using VNC client !!! | Use this instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment