vnc - bunnyamin/bunnix GitHub Wiki
Clone, mirror remote server X Window System desktop environment on local client.
Set up a VNC server that can only be connected to locally. Remote connection is only possible through "tunneling" via SSH.
- Start the server, await connection only from localhost
$ x0vncserver -display :0 -rfbport=5901 -ZlibLevel=9 -ImprovedHextile -localhost
. - The
x0vncserver
requires a running X Window System session, therefore, startx0vncserver
after the user is logged in. - Verify that the port is open
ss -ltunp | grep vnc
- Verify the connection
$ nc -zv <IP> <PORT>
should return<IP> <PORT> (rfb) open
- Configure the [SSH] server, and start it as as service.
- Connect to the remote server
ssh -vvx -p <SSH PORT>49999 -i ~/.ssh/prv/[email protected] [email protected] -L <SSH PORT>49999:localhost:<VNC PORT>5901
.
-
For Gnome desktop install
gnome-remote-desktop
. -
Start the service for user
systemctl start --user gnome-remote-desktop
. It cannot be enabled. -
The service file is found at
/usr/lib/systemd/user/gnome-remote-desktop.service
. -
Assign "password" to disable "New connections must ask for access"
gsettings set org.gnome.desktop.remote-desktop.vnc auth-method 'password'
. -
To connect a password must be porovided, the problem is how to assign a password?
-
Other options are
org.gnome.desktop.remote-desktop.vnc view-only <bool>
.
- For SystemD create a
unit
~/.config/systemd/user/x0vncserver.service. - Enable it
systemctl --user enable x0vncserver
.
- Connect to the server, multiple connections are possible:
-
ssh <SERVER IP>[email protected] -L <SSH PORT 1>:localhost:<VNC PORT 1> -L <SSH PORT 2>:localhost:<VNC PORT 2>
.
-
For AVNC:
- Host
127.0.0.1:5901
- Use SSH tunnel
192.168.1.102:49999
- Select the private key
- Connect to remote desktop
$ vncviewer -SecurityTypes None -AcceptClipboard -SetPrimary -SendClipboard -SendPrimary -FullColor -PreferredEncoding Tight -QualityLevel 9 -CompressLevel 9 -DotWhenNoCursor localhost::<PORT>5901
.
vncviewer -Log *:stdout:100
Event | Error | Cause | Consequence | Remedy |
---|---|---|---|---|
vncviewer |
<IP> 5900 (rfb): No route to host |
The IP or port may be unreachable. | ||
vncviewer |
X Error of failed request: BadMatch |
The remote desktop is running wayland as display manager. |
vncviewer is disconnected. |
Change display manager to Xorg . |
vncviewer |
No error message. | The remote desktop is running wayland as display manager. |
Connection results in a black screen. | Either switch display manager or find a VNC server that supports Wayland. |
systemctl --user start x0vncserver |
Authorization required, but no authorization protocol specified |
Solved when display is correctly declared. |
||
systemctl --user start x0vncserver |
x0vncserver: unable to open display ":0" |
|||
vncviewer |
The connection was dropped by the server before the session could be established. |
First ensure that the hostname is associated with the $DISPLAY
in .Xauthority
:
xauth list
xauth add $DISPLAY . ffffff
Declare an environment variable pointing to the current user's .Xauthority
in
systemd/user/x0vncserver.service
:
Environment="XAUTHORITY=/home/user/.Xauthority"