Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Run software update in non-admin account?

I did some searching through past posts, but the most recent one I found was several years old.


Is there any way to run Software Update automatically in a non-admin account? I run in a non-admin account unless there's some task that really needs admin privileges to complete, for security purposes, but having Software Update not run automatically is rather suboptimal for security.


So, is there any way to get Software Update to check for updates automatically from a non-admin account? (I'm not averse to using the crontab or launchd, if necessary—I've never done it before, but given instructions, I'm sure I could figure it out.


Thanks in advance!

MacBook Pro, Mac OS X (10.6.7), 256 GB SSD, 2.2 GHz Intel Core i7

Posted on May 31, 2011 4:13 PM

Reply
31 replies

May 31, 2011 4:55 PM in response to joshz

Did some research on this the other day, to see if i could get Software Update to run in the middle of the night like Windows can do.


Software Update requires Root powers, so when you give it your Admin Password your opening a sudo window of 5 minutes for it to complete it's task.


Software Update doesn't check for updates while in Standard User becuase Standard Users supposedly can't do anything about it anyway and it would be a obvious distraction. "Mommy the computer....!!!"


Apple should have a option in Software update preferences to let certain Standard Users know a Software Update is ready just for the purpose your explaining. I run in Standard as well.




I ran some Software Update commands via the Terminal for a launchd just to see what I could do.


Apprantly one can DOWNLOAD updates automatically with launchd in Admin, but not install them because of the need for sudo.


I just misssed a perfect opoortunity (todays update) to run a launchd to do automatic downloads of Software update, then see how to go about installing them afterwards. So fsck me, I'll have to wait now. (unless i use my other machine! ahhh!!)



Anyway the program you want is this little gem: Lingon


it's on Sourceforge (grab the image)


User uploaded file


Ok so that takes care of the Software update downloads (man softwareupdate in Terminal for commands)


/usr/sbin/softwareupdate --download --all


Will do the automatic downloads, now it's just a script away to let you know ( a nice pop up window) that you have something in your folder where the Software Update just downloaded into.


That's the next question is where that is and how to run it. 😀

May 31, 2011 6:21 PM in response to joshz

Hmm…I had a thought. As I shut down my computer most nights (having an SSD makes that easy), I could set up Software Update as a login item, or, better, write a script that runs software update only if it hasn't run in the last {day, week}. Is there any way to determine from the command line when Software Update last ran?

May 31, 2011 7:19 PM in response to joshz

Software Update isn't installing via launchd in Root User while in another account.


I even put the com.me.AutoSoftwareUpdate in the System Daemons.


I don't know if it's Mandatory Access Control getting in the way or if it's a bad command, or if I have to actually be logged in Root User to have it work.



I do know running a wifi sniffer on another Mac I get a short burst of traffic at the schedualed launchd time and then nothing.



I think the best would be to do the auto download and then script a notice with AppleScript.


Do some more work on it tommorow. 🙂

Jun 1, 2011 11:25 PM in response to geerm

Sorry, make that softwareupdate -dia download install all there are some other options, see softwareupdate -h for details


Your post reminded me i had some pending updates to run 😀 so here's some sample output


# softwareupdate -dia

Software Update Tool

Copyright 2002-2009 Apple





Downloading Security Update 2011-003

Verifying Security Update 2011-003

Waiting to install Security Update 2011-003

Checking packages…

Installing

Waiting for other installations to complete…

Validating packages…

Writing files…

Removing old files…

Optimizing system for installed software…

Moving items into place…

Running package scripts…

Registering updated applications…

Writing package receipts…

Installed ProKit Update

Installed Security Update 2011-002

Installed Snow Leopard Font Update

Installed Security Update 2011-003

Installed iTunes

Installed Safari

Done.



You have installed one or more updates that requires that you restart your

computer. Please restart immediately.

Jun 2, 2011 3:19 PM in response to geerm

softwareupdate's man page says that installing requires root, but my default account isn't in the sudoers file, and I don't want it to be, for security.


But is Lingon compatible with Snow Leopard? I'd be perfectly fine with SU 'stupidly' checking on a weekly basis, I just want to make sure that using Lingon wouldn't cause any problems. If it would, are there any good guides for using launchd out there?

Jun 2, 2011 6:16 PM in response to joshz

  1. If you use launchd, you can run that as root and the daemon will run in the background and you'll be up to date without even worrying
  2. If you want to do it manually as a regular user you can allow your normal user the use of sudo for a specific command


if you're going to use #2, then run the following on your admin account


sudo visudo


Where it says


# User privilege specification

root ALL=(ALL) ALL

%admin ALL=(ALL) ALL


Add


yourUserHere ALL=(ALL) NOPASSWD: /usr/sbin/softwareupdate


the NOPASSWD is optional.


But, here's this in aciton with a standard user called tst


$ su tst

Password:

bash-3.2$ whoami

tst

bash-3.2$ id tst

uid=502(tst) gid=20(staff) groups=20(staff),403(com.apple.sharepoint.group.2),61(localaccounts),12(everyon e),402(com.apple.sharepoint.group.1)


$ sudo softwareupdate -dia

Software Update Tool

Copyright 2002-2009 Apple


Done.



The id part is just so you can see it's not a admin, and well there aren't any updates pending on my machine

Jun 2, 2011 6:41 PM in response to geerm

But that wouldn't prompt me to reboot, would it? If it's running in the background and requires a reboot, it wouldn't be good to keep running with the updates. I mean, I suppose I could pipe it into grep or something and search for "restart" or something like that, but that's getting a bit kludgy.


But my shell script could just open Software Update—that's not really the issue. My issue now is: how do I set up launchd? Does Lingon work with Snow Leopard? If not, how do I set up a launchd task?

Jun 2, 2011 7:19 PM in response to joshz

No it wont prompt you to restart, you would have to do some searching for the text and then maybe have it email you. Still, I dont think a big deal if you're used to shutting down your computer every day.




Here's some reading material on launchd

http://www.macgeekery.com/tips/all_about_launchd_items_and_how_to_make_one_yours elf

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ man1/launchctl.1.html

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ man5/launchd.plist.5.html#//apple_ref/doc/man/5/launchd.plist

Run software update in non-admin account?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.