MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
November
Sun Mon Tue Wed Thu Fri Sat
   
29      
2011
Months
Nov


Tue, Nov 29, 2011 8:23 pm

Starting OSXVnc From a Command Line

I needed to remotely start VNC server software on an Apple OS X 10.3, aka Panther, system. I had SSH access to the system.

I could tell the software wasn't currently running by checking to see if the system was listening for connections on the default port, tcp port 5900, using the netstat command.

$ netstat -a | grep 5900
$

I tried started the software running in the background by issuing the command /Applications/OSXvnc.app/OSXvnc-server & at a terminal prompt, but OSXVnc didn't start, because, though I was logged into an account with administrator privileges, I wasn't logged into the root account.

$ /Applications/OSXvnc.app/OSXvnc-server &
2011-11-29 10:22:55.218 OSXvnc-server[385] Main Bundle: /Applications/OSXvnc.app
kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only
2011-11-29 10:22:55.225 OSXvnc-server[385] screen format not supported.  exiting.

So I then used sudo to assume the identity of the root account to run the coomand. When prompted for a password I entered the password for the administrator account under which I was already logged into the system I was then able to successfully start OSXvnc.

Greg-Computer:/ JDoe$ sudo -s
Password:
Greg-Computer:/ root# /Applications/OSXvnc.app/OSXvnc-server &
[1] 397
Greg-Computer:/ root# 2011-11-29 10:29:50.345 OSXvnc-server[397] Main Bundle: /Applications/OSXvnc.app
2011-11-29 10:29:50.353 OSXvnc-server[397] Waiting for clients
2011-11-29 10:29:50.353 OSXvnc-server[397] Started Listener Thread on port 5900 

By then hitting enter, I could get back to the shell prompt and check to ensure the program was listening on port 5900.

Greg-Computer:/ JDoe$ netstat -a | grep 5900
tcp4       0      0  *.5900                 *.*                    LISTEN

If you need to change the VNC password, you can use the storepasswd command in the /Applications/OSXvnc.app directory.

$ /Applications/OSXvnc.app/storepasswd -h

usage:  storepasswd <password> <filename>

Stores a password in encrypted format.
The resulting file can be used with the -rfbauth argument to OSXvnc.

The VNC password is normally stored in /Applications/OSXvnc.app/.osxvncauth.

You can change the password by using sudo to assume the identity of the root account and then using the storepasswd command, similar to the example below:

Greg-Computer:~ JDoe$ sudo -s
Password:
Greg-Computer:~ root# /Applications/OSXvnc.app/storepasswd Some-Password /Applications/OSXvnc.app/.osxvncauth
storing password succeeded.
Greg-Computer:~ root#

You can then use ps | grep OSXvnc | grep -v grep to find the process ID for the the existing OSXvnc server process, kill it with kill -9 <PID> and restart the software using the -rfbauth parameter. E.g., /Applications/OSXvnc.app/OSXvnc-server -rfbauth /Applications/OSXvnc.app/.osxvncauth & will start OSXvnc running again using the password stored in /Applications/OSXvnc.app/.osxvncauth. Putting an ampersand, &, at the end of the line puts the process running in the background, so that it will continue to run even after you log off.

Greg-Computer:~ root# ps | grep OSXvnc | grep -v grep
  397 std- S      3:12.77 /Applications/OSXvnc.app/OSXvnc-server
Greg-Computer:~ root# kill -HUP 397
Greg--Computer:~ root# /Applications/OSXvnc.app/OSXvnc-server -rfbauth /Applications/OSXvnc.app/.osxvncauth &
[1] 466
Greg--Computer:~ root# 2011-11-29 20:04:00.879 OSXvnc-server[466] Main Bundle: /Applications/OSXvnc.app
2011-11-29 20:04:00.886 OSXvnc-server[466] Waiting for clients
2011-11-29 20:04:00.887 OSXvnc-server[466] Started Listener Thread on port 5900

References:

  1. OSXvnc 1.71 Frequently Asked Questions
    Last Modified: 20 July 2006
    Redstone Software

[/os/os-x] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo