On Centos 7, if you implement remote desktop using Tigervnc or XRDP, there is a problem: The local connection to the remote server is not the user session that the physical machine is currently logged in, but a new and isolated session. So what do we need to do to connect to the entity session, what should we do? X11vnc! It can help us achieve this.
Centos 7 VNC Remote Desktop Cannot Connect To Entity Session
Install
# yum -y install x11vnc
Set Password
# x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /root/.vnc/passwd? [y]/n y
Password written to: /root/.vnc/passwd
Setting x11vnc Startup
- Create a new startVnc.sh file
# touch /etc/rc.d/init.d/startVnc.sh
- Edit the startVnc.sh file
# vim /etc/rc.d/init.d/startVnc.sh
- Add the following content, save and exit
#!/bin/bash #chkconfig: 345 88 14 nohup x11vnc --reopen --forever -rfbauth ~/.vnc/passwd &
- Create a new startVnc.service file
# touch /usr/lib/systemd/system/startVnc.service
- Edit the startVnc.service file
# vim /usr/lib/systemd/system/startVnc.service
- Add the following content, save and exit
[Unit] Description=start vnc service Requires=graphical.target After=graphical.target [Service] Type=forking User=root Group=root Restart=always TimeoutSec=5 IgnoreSIGPIPE=no KillMode=process GuessMainPID=no RemainAfterExit=no ExecStart=/etc/rc.d/init.d/startVnc.sh [Install] WantedBy=graphical.target
- Setting x11vnc startup
# systemctl enable /usr/lib/systemd/system/startVnc.service
- Reboot
# reboot
- Check if x11vnc is successfully started
# netstat -anp | grep 5900
Configuration completed
Now, try connecting to this server with other vnc clients. How about? Is it successful?