配置x11:一个远程的图形化传输协议
在服务器上:
sudo vim /etc/ssh/sshd_config
修改配置
AllowAgentForwarding yes AllowTcpForwarding yes X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost no
sudo service sshd restart
Host <host_name> HostName <ip> User <user_name> ForwardX11 yes ForwardX11Trusted yes ForwardAgent yes
测试:
配置x11vnc:一个传输的客服端
在服务器上:
sudo apt-get install x11vnc net-tools
2.运行x11vnc
x11vnc -display $DISPLAY -rfbport 5900
在服务器上:
1.安装x11vnc以及必要dependency
sudo apt-get install x11vnc net-tools xvfb fluxbox
2.设置$DISPLAY参数
export DISPLAY=:7 # 可以为其他数,just an example # 为了之后的方便可以写入~/.bashrc中 echo export DISPLAY=:7 >> ~/.bashrc source ~/.bashrc
3.新建虚拟桌面
Xvfb $DISPLAY -screen 0 1920x1080x24 & fluxbox &
4.运行x11vnc
x11vnc -display $DISPLAY -rfbport 5900
在本地上:
测试:
xeyes
常见问题:
$ Xvfb $DISPLAY -screen 0 1920x1080x24 (EE) Fatal server error: (EE) Server is already active for display 7 If this server is no longer running, remove /tmp/.X7-lock and start again. (EE)
rm /tmp/.X7-lock
$ Xvfb $DISPLAY -screen 0 1920x1080x24 _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: server already running (EE) Fatal server error: (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
$ ps -aux | grep Xvfb user 485583 0.0 0.1 213840 71628 pts/23 S+ 19:52 0:00 Xvfb :4 -screen 0 1920x1080x24 user 506709 0.0 0.0 12628 2304 pts/2 S+ 20:09 0:00 grep --color=auto Xvfb
$ kill -9 485583
本文链接:https://blog.runxinyun.com/post/182.html 转载需授权!
留言0