View Single Post
  #1  
Old September 5th, 2003, 04:38 AM
simon1663 simon1663 is offline
Registered User
 
Join Date: Aug 2001
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
simon1663 is on a distinguished road
[HOWTO] - Launch and run VNC server remotely

Hi,
I figured out a way to launch VNC using ssh and then control it remotely. It has worked out very well for me. I thought I share this tip with others as well.

First of all, if you don’t know what VNC is, learn about it here: http://www.uk.research.att.com/vnc/

Basically, it’s a multi-platform screen control tool. It’s free and available under GPL. So, you don’t have to pay a cent to use it. Also, much simpler and better thing to use than that of Timbuktu (although not sophisticated like Timbuktu).


If you already don’t have VNC Server, download it from here: http://netmath.math.uiuc.edu/VNC-osx.htm


Install it under /Applications and then launch it. You can now test with vncthing from http://www.webthing.net/vncthing/

Note that, depending on what port you are running it on, you may have to do ip_address:<display number 1 / 2> to connect.


Anyway, we are going write a shell script now which will launch the vnc server for us from terminal.


Say you have installed OSXvnc in this directory /Applications/OSXvnc.app/

Launch terminal
Go to that directory /Applications/OSXvnc.app/ or the directory you install OSXvnc at by doing “cd /Applications/OSXvnc.app”.

Now do
cd Contents
cd macos

You will see that there are three executable files there:
“OSXvnc” , “OSXvnc-server” , “storepasswd”

storepasswd is the executable used for storing encrypted password for VNC

you can just run it to see what it has to say:
do “./storepasswd”

Say you want to store the password “mamamia” for VNC (when you connect, you will be prompted for password, and you have to type this password).

Let’s store this password by doing :
“sudo ./storepasswd mamamia ./passwdfile”
You may be asked for your password (make sure you have admin access to the computer).

Now create the file /usr/bin/launchvnc

These are the content:
vncdir=/Applications/OSXvnc.app/contents/macos
sudo -u root $vncdir/OSXvnc-server -rfbauth $vncdir/passwdfile




save and exit

Now set the permission :
“sudo chmod 755 /usr/bin/launchvnc”

Just a note that, we are doing “sudo –u root” i.e. running as the user root is because you will not get access to someone’s else’s display without being the super user. Also note that we are using the passwdfile we created earlier.


Ok, all setup done, now run a test:

Run the shell script /usr/bin/launchvnc from terminal by either doing “/usr/bin/launchvnc” or “launchvnc” if “/usr/bin” is already in your path.

You may be asked for your password.

Now try connecting with VNCThing (http://www.webthing.net/vncthing/) or any other VNC client from some other computer. Server address will be “<ip address of the machine running vnc server>:1”

Note the “:1” at the end.

Type the password you created earlier (mamamia)

And done!

Running vnc like is this is much better than just launching it startup and leaving it there. Because, then you may risk being attacked.

I use this to do system admin in my machine @ Sydney. I live 800kms down @ Melbourne.

This works with OSX 10.1 and 10.2. Should work with 10.3 when it comes out.

Also, check on versiontracker.com for more vnc stuff.

Comments, problems and suggestions at simon1663@yahoo.com
Hope it helps you.
Reply With Quote