Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Remotely starting a VNC connection

Remotely starting a VNC connection
Thread Tools
Kikaida
Fresh-Faced Recruit
Join Date: Jan 2002
Location: NYC
Status: Offline
Reply With Quote
Feb 2, 2008, 11:40 AM
 
Here's my situation, hopefully one of you can help. I have a Mac Pro 2.66 that will no longer output video from any of the cards/slots. I've tested my display on another computer, so I know that's not the problem. Running 10.5.1. Seems to boot fine.

I can mount my Mac Pro's boot drive on my MacBook Pro by starting in FireWire Target mode. I'm pretty sure I don't have login access to the Mac Pro over the network. I think I turned it off. Can anyone think of a way to start the VNC server by editing or writing a file to the mounted boot drive? Or any other method? I'm open to all suggestions...

Thanks!
     
Cold Warrior
Moderator
Join Date: Jan 2001
Location: Polwaristan
Status: Offline
Reply With Quote
Feb 2, 2008, 03:12 PM
 
Not sure I understand your question...

You want the Mac Pro to always be available for a VNC connection from another Mac, but can't enable it because of your video issues?

Try this: boot your MBP from your MP's drive. To do this, put your MP drive in firewire target disk mode (like you did before), then reboot your MBP. At startup (the chime), hold down option. You should get a list of two OS X-ready drives: your usual MBP install, and the one on your MP drive. Choose the MP drive. This will boot OS X using the MP drive as if you were sitting at the MP. Make your remote login/VNC changes, then shut down. When you start up the Mac Pro again (not connected to your MBP this time), it should still have all the VNC/remote login changes you made.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 2, 2008, 04:43 PM
 
There is a way to startup the VNC server over SSH too. Let me know if you still want these instructions.
     
MarkLT1
Mac Enthusiast
Join Date: Nov 2002
Location: More Cowbell...
Status: Offline
Reply With Quote
Feb 2, 2008, 05:33 PM
 
Originally Posted by besson3c View Post
There is a way to startup the VNC server over SSH too. Let me know if you still want these instructions.
I'd love to see them. The other day I got home and suddenly wished I had turned the VNC server on my Mac Pro at work on. Was SOL, and couldn't find any way to turn it on via ssh on google.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 2, 2008, 08:28 PM
 
Originally Posted by MarkLT1 View Post
I'd love to see them. The other day I got home and suddenly wished I had turned the VNC server on my Mac Pro at work on. Was SOL, and couldn't find any way to turn it on via ssh on google.

Well, either you can download, compile, and install tightvnc and start it up via the command line by typing "vncserver", or else you can download OSXVnc, cd into the package (cd OSXVnc.app), and do the following:

A: To startup OSXvnc from command line, go inside the Application directory(OSXvnc.app) and launch the OSXvnc-server process. To change parameters you will need to give it arguments (-rfbport to set port, -vncauth to specify a password file, etc). For usage run the command with -help. For example:
/Applications/OSXvnc.app/osxvnc-server -rfbport 5901
If you want to fork this into the background so that you can close your terminal session, add a "&" to the end of this. If you want to connect to this via ARD, change the port to 5900:

/Applications/OSXvnc.app/osxvnc-server -rfbport 5900 &
     
Kikaida  (op)
Fresh-Faced Recruit
Join Date: Jan 2002
Location: NYC
Status: Offline
Reply With Quote
Feb 2, 2008, 09:37 PM
 
This worked perfectly. If you're ever in New York City, I owe you a beer. Thanks a million.
     
Cold Warrior
Moderator
Join Date: Jan 2001
Location: Polwaristan
Status: Offline
Reply With Quote
Feb 2, 2008, 09:40 PM
 
Originally Posted by Kikaida View Post
This worked perfectly. If you're ever in New York City, I owe you a beer. Thanks a million.
Which solution did you try, mine or besson's?
     
Kikaida  (op)
Fresh-Faced Recruit
Join Date: Jan 2002
Location: NYC
Status: Offline
Reply With Quote
Feb 3, 2008, 10:07 AM
 
I used yours. Thanks!
     
MarkLT1
Mac Enthusiast
Join Date: Nov 2002
Location: More Cowbell...
Status: Offline
Reply With Quote
Feb 5, 2008, 09:02 PM
 
Originally Posted by besson3c View Post
Well, either you can download, compile, and install tightvnc and start it up via the command line by typing "vncserver", or else you can download OSXVnc, cd into the package (cd OSXVnc.app), and do the following:



If you want to fork this into the background so that you can close your terminal session, add a "&" to the end of this. If you want to connect to this via ARD, change the port to 5900:
Do you know if there is a way to start up the Apple supplied VNC server from the command line?
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Feb 5, 2008, 10:43 PM
 
Originally Posted by MarkLT1 View Post
Do you know if there is a way to start up the Apple supplied VNC server from the command line?
Yeah, with VNC now being built into the system, it would be silly if we had to download some third party implementation just to remotely enable it.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 5, 2008, 11:08 PM
 
I don't see a way to startup Apple's VNC - no launchd control, the binaries that run when you startup VNC in the GUI don't seem to be daemons that can be started up in the command line, this looks like proprietary Apple voodoo.
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Feb 6, 2008, 12:12 AM
 
pity... there should be some way of turning "screen sharing" (as they call it) on and off, using "defaults write" or some such. Never mind.
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Feb 6, 2008, 12:19 AM
 
Ah, look at that... it can be done.

The method documented at the above link is very dodgy, but it works (apparently). It implies that it should be possible to do it using "defaults write" commands if you know exactly what arguments to send. Hopefully somebody will be able to work out how to do it that way (would be a much more 'correct' way).
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 6, 2008, 12:22 AM
 
Wow, dodgy is an understatement... Sounds like it would be much better to keep a copy of OSXVnc around so that you can start that up on port 5901, and use that to start up Screen Sharing on port 5900 (its default) for when/if unique Screen Sharing features are necessary...
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 6, 2008, 04:42 AM
 
Originally Posted by Brass View Post
Yeah, with VNC now being built into the system, it would be silly if we had to download some third party implementation just to remotely enable it.
Indeed. Fortunately no third-party utilities are needed at all. It's very simple. Just log onto a rmeote Mac through shh and do

To turn VNC on
• sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate
• sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes
• sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvncpw -vncpw abc (where "abc" is the password you want to use)

To turn VNC off
• sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy no
• sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate

There's a ton of options and you can set up users, passwords, etc. all through the CLI. For more information try:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help

A good approach is to right a little shell script that does the stuff you need and save it with proper permissions. When you need to configure VNC remotely, you just copy your script to a remote machine and run it there. It's as simple as that.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 6, 2008, 11:24 AM
 
Good find Simon! I didn't notice that little Perl kickstart script for some reason...
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 6, 2008, 05:35 PM
 
Yeah, it's really very handy. I use it all the time. I see no reason to leave more than ssh on when I can turn stuff on and off when it's needed.
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 02:34 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,