image
image

Go Back   macosx.com > Mac Help Forums > HOWTO & FAQs

Reply
 
Thread Tools
  #1  
Old September 5th, 2003, 03:38 AM
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
  #2  
Old November 1st, 2003, 12:17 PM
Mac Developer
 
Join Date: Sep 2001
Location: Nashville, TN
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
wadesworld is on a distinguished road
There's a much easier way than that.

Download this implementation of VNC (which is the best):
http://www.redstonesoftware.com/vnc.html

Put it in your applications directory. Run it once and set your passwords and other options.

Then you can run it remotely by SSH'ing in and doing:

open /Applications/OSXvnc

Wade
Reply With Quote
  #3  
Old November 2nd, 2003, 03:53 AM
Registered User
 
Join Date: Apr 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
themacnut is on a distinguished road
You can even put the "open /Applications/OSXvnc" command in a shell script with a short name like "startvnc" and run it from an SSH shell.

That's what I do.
__________________
The MacNut
1.8 GHz Power Mac G5
OS 10.4.3, 1 GB RAM, 80GB internal HD
List Owner, AppleWorks Email Discussion List
http://awlist.macnuthome.com
Reply With Quote
  #4  
Old November 3rd, 2003, 02:41 PM
Registered User
 
Join Date: Feb 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
lowmagnet is on a distinguished road
Does anybody else have a problem with forwarding ports through SSH under Panther, or is it just me. I set my VNC session up and I could get a connection locally, but when I forward anything to my mack as my primary user, it blows up big time. Setting up forwarding from the point localhost to my machine here at work doesn't work at all. This is most frustrating

The same goes for my squid forwarding. I ran ssh -v -C -L 3182:localhost:3182 to tunnel my squid connection, and not even that works. Nothing but 'connection refused'
Reply With Quote
  #5  
Old November 3rd, 2003, 02:56 PM
Registered User
 
Join Date: Feb 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
lowmagnet is on a distinguished road
OK, fixed the problem mentioned above via the following link:

SSH Problems on Panther

It boils down to this: you can no longer refer to your remote machine as 'localhost' when running ssh tunnels. Refer to them as 127.0.0.1. I knew there had to be some trick to it.
Reply With Quote
  #6  
Old November 3rd, 2003, 03:14 PM
Registered User
 
Join Date: Feb 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
lowmagnet is on a distinguished road
Well, now the problem is that I'm getting this:

Quote:
CFMessagePortCreateLocal failed (name = Processes-0.19005441 error = 0)
Abort
And then it crashes.
Reply With Quote
  #7  
Old April 6th, 2004, 02:01 AM
Registered User
 
Join Date: Jan 2002
Location: /Los Angeles, CA/Users/John aka "bossa nova"
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
bossa nova is on a distinguished road
lowmagnet,

i am trying to setup vnc via port forwarding and one thing i found was that you are supposed to create a key. if i don't do this it lets me create the key anyway. so if it uses the key but lets anyone create one, why is it secure?
Reply With Quote
  #8  
Old April 10th, 2004, 05:25 AM
owaters's Avatar
Tech
 
Join Date: Jun 2002
Location: UK
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
owaters is on a distinguished road
Is VNC better than using Apple Remote Desktop for controlling a remote computer over the internet?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[HOWTO] Install pure-ftpd gatorparrots HOWTO & FAQs 17 February 23rd, 2003 01:17 AM


All times are GMT -5. The time now is 09:02 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.