登录前如何启动VNC服务器?


19

我想在桌面上运行x11vnc(或其他VNC服务器),但是我找不到在任何用户登录之前启动它的方法。回到当我使用原始Ubuntu 10.10 Vino时,默认情况下会这样做。但是,我现在在Xubuntu中找不到解决方法。

Answers:


15

我通常建议使用备用VNC服务器,x11vncserver或FreeNX。

FreeNX如何下载信息

x11 VNC和文档

这假定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="<WIDTH>x<HEIGHT>"
#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脚本,以便在适当的时间向其发送启动和停止命令。

注意:sudo update-rc.d vncserver 99如果作业在引导过程中运行得太早,则可能需要使用它。

要启动服务器而不重新引导,请运行 sudo /etc/init.d/vncserver start

最后,使用端口590X上的VNC客户端连接到服务器,其中X是vncserver脚本中“ DISPLAY”的值

资源


sudo update-rc.d vncserver defaults 99我认为延迟序列启动命令应该是。
Christoph

一切都很好,除了我没有网络权限或由于某种原因垃圾桶。askubuntu.com/questions/722802/...
唐尼五,

4

我的解决方案:

  1. 转到桌面共享,并允许其共享并输入一个好的密码。(单击以允许权限)
  2. 进入屏幕并将其设置为30秒后锁定。
  3. 转到用户并允许自动登录。

vino服务器启动,您应该能够连接到它。如果需要保护它,可以使用ssh为VNC创建隧道(我使用过PUTTY,效果很好)。您还可以启用防火墙,仅允许来自特定地址的流量。此解决方案已在20多个Ubuntu盒子中为我工作。


0

尝试时会发生什么:(?)

vino-preferences

..并将其添加到Autostarted Apps中,以启动vino服务器:

/usr/lib/vino/vino-server

更新:

尝试这个:

在启动时在Ubuntu上启动VNC服务器

http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot


仅在登录后启动应用程序。我想开始之前,我甚至登录。
PHLAK

添加了可能的解决方案..
david6

2
解决方案已过时。
vainolo 2012年

有人说这已经过时了,但我今天才这样做,而且效果很好。运行update-rc.d命令的一些警告但有效。
约翰·马丁
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.