A script that will make a Mac join specific WiFi network and enable remote login/management

0

I have physical access to a Mac Pro, but it has no monitor and I want to access it remotely. I don't know what state the Mac was left in (network connection, sharing prefs, etc). I am pretty sure I can open up a terminal window and execute a script without actually seeing what I am doing, just using the keyboard. Can someone help me with creating a script that will verify wifi is turned on, connect to a protected wifi network and enable remote management/login so I can VNC in?

Well since I didn't get any responses I did some googling and came up with the following:

To enable screen sharing I used

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all

To turn on airport I used

networksetup -setairportpower airport on

To connect to a specific network I used

networksetup -setairportnetwork en2 "$NETWORKNAME" $PASSWORD

It's worth noting that since the Mac Pro has two Ethernet ports, the Airport interface is en2, not en0 or en1.

Joey

Posted 2015-08-03T03:22:37.347

Reputation: 11

You should convert the solution you found into an answer, then accept it. – Gordon Davisson – 2015-08-04T18:27:21.740

Answers

1

To enable screen sharing I used

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all

To turn on airport I used

networksetup -setairportpower airport on

To connect to a specific network I used

networksetup -setairportnetwork en2 "$NETWORKNAME" $PASSWORD

It's worth noting that since the Mac Pro has two Ethernet ports, the Airport interface is en2, not en0 or en1.

Joey

Posted 2015-08-03T03:22:37.347

Reputation: 11