Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sadpanda

macrumors newbie
Original poster
Jul 9, 2009
10
0
New England
I manage several staffed Mac labs for a large educational institution. I have managed their shutdown and restart times via Workgroup Manager; however, occasionally the need arises for the lab monitor to restart multiple machines. These monitors are relatively unprivileged users, and we don't want to purchase remote desktop for each of the lab monitor stations.

In our PC labs, the lab monitor has a script that he or she can run which basically does the following: The lab monitor runs the script, which interactively asks them for a list of machine numbers separated by spaces (eg, "13 25 42 48"). The script then goes about the process of restarting the specified machines without any administrative action or input from the user.

My question is this: Can I mirror this script on the Mac? I'd prefer to stay in simple scripting, either shell scripts or perl, possibly ruby.

Thanks.
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
You can send the command sudo shutdown -r now via SSH and that will restart a Mac remotely but the user logging in via SSH needs to be authorised. You could probably be able to get around this by having it log in via SSH using public key authentication and just setting the script to executable only (remove read and write privileges).

You might need to do a bit of playing around with this but that is the best I can come up with at the moment.
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,776
15
Grand Rapids, MI, USA
^^ That's the option I would generally recommend also, but it requires them to have an administrator password, and you said they're "relatively unprivileged."

OTOH if the user can sudo, this has the advantage that it's easily scriptable.

Which would make me ask... your Windows setup doesn't really have a tool that lets a standard user shut down other computers remotely without escalating privileges, does it? That sounds crazy to me. :(

Another major option would be that you could install a free alternative to the remote desktop client program. Here's an example:

http://macapper.com/2007/03/19/vnc-remote-desktop-for-free/
 

sadpanda

macrumors newbie
Original poster
Jul 9, 2009
10
0
New England
Which would make me ask... your Windows setup doesn't really have a tool that lets a standard user shut down other computers remotely without escalating privileges, does it? That sounds crazy to me. :(

http://macapper.com/2007/03/19/vnc-remote-desktop-for-free/

The short answer is no. The PC script does require escalating priveleges, however I'm not terribly familiar with DOS scripting, so I can't explain the details. The problem with a VNC alternative is that it doesn't have the same power as ARD or as this script: the point is not to take control of the machine(s), but rather to be able to shutdown or restart multiple machines at once without the lab monitor leaving their station.
 

sadpanda

macrumors newbie
Original poster
Jul 9, 2009
10
0
New England
You can send the command sudo shutdown -r now via SSH and that will restart a Mac remotely but the user logging in via SSH needs to be authorised. You could probably be able to get around this by having it log in via SSH using public key authentication and just setting the script to executable only (remove read and write privileges).

You might need to do a bit of playing around with this but that is the best I can come up with at the moment.

Thanks, I'll give the public key authentication a shot, I hadn't thought of that. Something along those lines would probably work well.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.