Jeff, to run commands with admin rights without password, you can do it the unix way. Run "sudo visudo" and add something like this:
steen ALL=(ALL) NOPASSWD: /usr/bin/du then from ruby you can run the command without needing a password: steen$ macirb irb(main):001:0> spawn 'sudo du -s -m /Users/rebecka' => 15088 irb(main):002:0> 394 /Users/rebecka /Steen On Mon, Apr 8, 2013 at 8:08 PM, Jeff Dyck <fsjj...@gmail.com> wrote: > Hey all, I'm desperately hoping for some help here... > > I'm a System Admin for a School District with thousands of Macs. In the > past I developed an AppleScript Studio application that our technicians > used to backup and restore user accounts when we do system migrations and > image updates (basically rsync with some internal logic to filter out files > that might conflict). > > Anyway, with AppleScript Studio long deprecated, we're starting to see > some issues with it running on 10.8, so I've started working on a > replacement in MacRuby (which I've started to move to for other > development)... I love Ruby vs the pain of AppleScript, especially for > things like dealing with xml and whatnot, but I'm running into one HUGE > challenge... > > My app requires admin privileges to backup and restore user accounts and > restore permissions. In AppleScript Studio this was relatively simple to > do using the "do shell script with admin privs' command. In MacRuby.... > I'm stumped. > > I've dug in a bit into the Authorization framework, and looked at some of > Apple's documentation for splitting your app into helper tools... but it's > difficult enough to follow the Obj-C stuff, migrating that to Ruby is > probably over my head. > > So long story short, anyone have some samples of how to do this with > MacRuby? I'd need to be able to do things like: > • Calculate size of folders and count of files in another user > account (and get result back) > • Send an RSYNC command as admin (and get feedback for calculating > progress) > > Here's hoping someone can point me in the right direction. Thanks in > advance. > > Jeff > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > https://lists.macosforge.org/mailman/listinfo/macruby-devel > -- Steen Klingberg Senior Consultant Steen Klingberg AB Phone: +46730599063
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macruby-devel