如何在登录前启动VNC服务器?
我想在我的桌面上运行x11vnc(或另一个VNC服务器),但在任何用户登录之前我都无法找到启动它的方法。当我使用vanilla Ubuntu 10.10 Vino时,我默认这样做了。 但是,我现在在Xubuntu找不到办法。
我通常建议使用备用VNC服务器x11vncserver或FreeNX。
FreeNX如何下载信息
x11 VNC和docs
这假定VNC已设置且可运行:
将下面的代码块复制到/etc/init.d/vncserver
。 最简单的方法是将其复制到剪贴板,在终端中运行sudo -i && cat > /etc/init.d/vncserver && exit
,粘贴它,然后键入Ctrl -D`。 请务必将USER变量更改为您希望VNC服务器运行的任何用户。
#!/bin/sh -e ### BEGIN INIT INFO # Provides: vncserver # Required-Start: networking # Default-Start: 3 4 5 # Default-Stop: 0 6 ### END INIT INFO PATH="$PATH:/usr/X11R6/bin/" # The Username:Group that will run VNC export USER="mythtv" #${RUNAS} # The display that VNC will use DISPLAY="1" # Color depth (between 8 and 32) DEPTH="16" # The Desktop geometry to use. #GEOMETRY="x" #GEOMETRY="800x600" GEOMETRY="1024x768" #GEOMETRY="1280x1024" # The name that the VNC Desktop will have. NAME="my-vnc-server" OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}" . /lib/lsb/init-functions case "$1" in start) log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver ${OPTIONS}" ;; stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}" ;; restart) $0 stop $0 start ;; esac exit 0
使用sudo chmod +x /etc/init.d/vncserver
使脚本可执行。
然后,运行sudo update-rc.d vncserver defaults
。 这会将适当的符号链接添加到vncserver脚本,以便在适当的时间发送start和stop命令。
注意:如果作业在引导过程中过早运行,则可能需要使用sudo update-rc.d vncserver 99
。
要在不重新启动的情况下启动服务器,请运行sudo /etc/init.d/vncserver start
最后,使用端口590X上的VNC客户端连接到您的服务器,其中X是vncserver脚本中“DISPLAY”的值
资源
我的解决方案
- 转到桌面共享并允许它共享并输入一个好密码。 (单击“关闭”以允许权限)
- 转到屏幕并在30秒后将其设置为锁定。
- 转到用户并允许自动登录。
vino服务器启动,您应该可以附加到它。 如果需要保护它,可以使用ssh为VNC创建隧道(我使用了PUTTY并且效果非常好)。 您还可以启用防火墙,只允许来自特定地址的流量。 这个解决方案在20多个Ubuntu盒子里对我有用。
当你尝试时会发生什么:(?)
vino-preferences
..并在Autostarted Apps中添加此项,以启动vino服务器:
/usr/lib/vino/vino-server
更新:
试试这个:
在Ubuntu上启动VNC服务器
http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot