windows remote connection Ubuntu18 desktop

Refer to  Ubuntu18.04~Ubuntu22.04 to install and configure VNC_ubuntu installation vnc-CSDN blog

1. Install x11vnc on Ubtuntu

sudo apt-get install x11vnc -y

set password

sudo x11vnc -storepasswd /etc/x11vnc.pass 

If you forget your password, you can reset your password by performing the above steps again.

sudo systemctl restart x11vnc


After installing x11vnc, you need to configure a service for it so that it can automatically restart. Create service file.

sudo vim /etc/systemd/system/x11vnc.service

Write the following content into the service file created above and save it. Note that by default these are the components that come with the Ubuntu system. If your desktop is not gdm, the following commands may not take effect, so just keep the operating system as it is.

[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target

After configuring the service, you still need to start it manually or restart the operating system. Here we choose to start it manually.

sudo systemctl start x11vnc

After starting, check the status. If no error is reported, it is successful and you can use the software to test. Viewing the status does not require sudo permissions, just normal permissions.

systemctl status x11vnc

2. Install VNC Viewer on windows 


Enter the remote IP and write whatever name you want

---------------------------------

After using it for a while, it suddenly failed to connect and reported an error: 

XOpenDisplay(":0") failed.

*** XOpenDisplay failed. No -display or DISPLAY.

systemctl status x11vnc

sudo startx //Start a display:

ctrl+z //Run in the background  

ps -aux|grep vnc

mobaXterm displayed after login

/usr/bin/xauth:  /home/nvidia/.Xauthority not writable, changes will be ignored
MoTTY X11 proxy: Unsupported authorisation protocol
MoTTY X11 proxy: Unsupported authorisation protocol
XCB failed to connect to the X server due to error:1.

Reference: mobaXterm cannot open the server qt interface_motty x11 proxy: unsupported authorization protoco-CSDN blog

Guess you like

Origin blog.csdn.net/qq_32636415/article/details/134663319