一台机器上的多个用户的VNC

我在运行OS X 10.5的机器上有几个用户帐户。 有没有办法让其中一个用户ssh进入机器,启动一台vnc服务器,然后连接到它? 我已经尝试了Vine Server,它应该具有类似的function,但似乎是使用ssh来启动服务器,或者已经在每个帐户中启动服务器,但不是两者都启动。

谢谢

内置于操作系统 – 没有。

你会想看看Aqua Connectterminal服务器和服务器故障这里的问题8966 。

我在前段时间(在老虎?)上讨论过这个问题,从来没有想出一个好的解决scheme。 我发现你必须以graphics方式login一个用户,然后启动VNC服务器,之后,你可以使用快速用户切换来切换到不同的用户并login。所以,这确实意味着没有人可以使用Mac本身[ 编辑 :作为快速用户切换对话框] – 他们都需要通过VNC连接,但很高兴看到,Mac将愉快地运行多个会话。 另外,虽然多人可以同时使用电脑,但是一次只能login一次,花费30秒到1分钟时间。]

有一件事要注意 :在networking启动指南中,我相信它说明你需要一个操作系统的许可证,每台机器将networking启动; 我假设这同样适用于这样的VNC设置。

我不记得,但这里有一些笔记和一些代码供你玩(风险自负)。

Mac Thin-Client Plan --------- Client: Uses paramiko script. User is asked for name and password. Tries to connect. Alerts user on failure. If it connects, it CDs to a certain directory on the server, and calls a function, using the name and password. Server: Script is run. Server checks if it is able to log the user in at that moment. When permitted, the console comes up, and then a VNC server is started. Server tells client which port VNC server is started on. Client then exits paramiko application, and launches a VNC application. When VNC application is exited, client goes back to the log-on screen. 

StartVNCLogin.sh(在Mac上作为服务器运行):

 #!/bin/bash # This script should be runnable by any user. It takes two parameters -- the user's name and password. # This script should be owned by root, and should let the owner read/write/execute, but no other user. # sudo chmod 700 /sbin/StartVNCLogin.sh # In /etc/sudoers, the script needs to be set up so all users can run it. # See http://mandrivausers.org/lofiversion/index.php/t33702.html. # use visudo to add "ALL ALL=NOPASSWD: /sbin/StartVNCLogin.sh" to the end of the file # With the parameters -- the user name and password -- the script will switch to the login screen, # and will then use applescript to log the user in # Afterwards, it will start a VNC session for that user, and return the port number. # At this point, the client can connect via VNC. say "Log on called" # Do we have root access? if [ ! $( id -u ) -eq 0 ]; then echo "Error: Script must be run with administrator priviledges" exit -1 fi # Get the user name and password if [ "$#" = "2" ]; then export USERNAME="$1" export PASSWORD="$2" else echo "Error: Please supply a username and password." exit -2 fi # This step should not be necessary, as the user had to use ssh to run this script # Verify that the user exists on the system USERID=`id -u $USERNAME`; if [[ -z $USERID ]]; then echo "Error: The user $USERNAME does not exist on this machine" exit -3; fi; # Now, switch to the login screen echo "Info: bringing up login screen" # Ask the logon screen to come up and allow us to log-in as the desired user #/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID $USERID & /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend sleep 15 # Then, use applescript to enter the user's password echo "Info: logging user in" # And enter in the password osascript <<END set pword to system attribute "PASSWORD" set username to system attribute "USERNAME" tell application "System Events" keystroke username keystroke return delay 1 keystroke pword delay 1 keystroke return keystroke return end tell END echo "Info: Waiting for user to be logged in" echo "Info: Starting VNC server." # Now, we start the VNC server if [ -x /Applications/Vine\ Server.app/Contents/Resources/OSXvnc-server ]; then /Applications/Vine\ Server.app/Contents/Resources/OSXvnc-server -rfbport 0 -desktop "New Desktop" -rfbnoauth -restartonuserswitch N -unicodekeyboard 0 -keyboardloading n -pressmodsforkeys n -eventtap 3 -swapbuttons -rendezvous y & else "Error: Can not find the VNC server application! The server is not properly configured for VNC login." exit -4; fi; 

客户端脚本中的重要部分(在Linux上运行):

 # note that I am redirecting stderr to stdout for simplicity chan.exec_command("sudo /sbin/StartVNCLogin.sh " + username + " " + pw + " 2>&1") stdout = chan.makefile('rb') vnc_port = -1 for line in stdout: print '... ' + line.strip('\n') # look for a line where a port is stated if line.find("Started Listener Thread on port") > -1: vnc_port = int(line.rsplit(' ', 1)[1]) print "--- The VNC Port is %d" % vnc_port chan.close() # sever the connection; we know what we need to know print "Done" #chan.close() t.close() os.system("vncviewer %s:%d -Shared -Fullscreen" % (hostname, vnc_port)) 

用XDMCP设置Xvnc,然后他们可以vnclogin到服务器。 网上有很多关于如何设置的指南,这里有一个 。

OS X 10.5已经包含一个VNC服务器,可以在账户的基础上进行configuration。

我想(在我面前没有Mac),你可以在System Preferences->Sharingfind这些设置。 就是这样

我们很高兴地将Vine Server for OSX和JollyFastVNC结合起来用于客户端。

Vine Server为每个login用户提供一个唯一端口号的“个人”VNC服务器实例。 唯一的窍门是用户需要已经login到在他们的账户下运行的VineServer才能够在VNC中login到Mac。引入的引导问题的解决scheme是Vine Server“系统服务器”,它提供了一个VNC会话Mac控制台 – 因此,让任何访问控制台会话的用户都可以自己login到Mac(从而启动他们自己的Vine Server实例)

configuration比较简单:

1 /打开快速用户切换,以便多个用户可以共享Mac。

2 /以真实的Mac控制台身份login,并以pipe理员用户的身份login,您也希望授予其远程访问权限。 以该用户的身份启动Vine Server,并选中“在login时打开”首选项。

3 /打开Vine服务器首选项并记下分配给此VNC服务器实例的端口号。 手动重新input该号码以将该实例“钉”到该端口以便后续启动。 另外,build议您在此为此唯一用户会话设置密码。

4 /转到“共享”选项卡,并确保选中“允许多个用户会话”

5 /转到启动选项卡并检查“系统服务器…”button。 在默认端口(5900)上启动系统服务器实例。 这将是您的控制台 VNC服务器使用。 (我build议你在这个上设置密码)

6closures首选项窗口,然后单击重新启动服务器button。

现在,您应该能够login到两个 VNC用户会话:一个是作为5900端口的控制台,一个是刚login的admin用户。

现在,为每个用户,让他们login并添加Vine Server到他们的docker,并重复上述步骤2,3和4。

我们注意到的唯一的两个问题是,如果Mac被重新启动,系统服务器将不会自动启动。 初始用户需要login并通过UI启动。

第二个问题是,如果用户通过远程VNC控制台会话login,则在控制台会话及其“个人”VNC会话中将看到他们随后使用Mac的情况。 即控制台会话保持绑定到最后login的用户,直到其他人远程login或本地login。 我们通过在login后再次打开远程控制台会话来解决这个问题,并使用快速用户切换到“显示login窗口”,这似乎强制控制台会话再次离开。

JollyFastVNCinput图片作为一个良好的“可用服务器”浏览器的Bonjour意识VNC客户端。 这为每个运行的Vine Server实例和控制台实例提供了远程Mac“主机名:端口”,如果您不记得您的端口号,可以轻松导航。

希望这可以帮助。