[Casper] Running script as current user

Ernst, Craig S. ERNSTCS at uwec.edu
Fri Feb 27 18:36:35 PST 2009


I would check the displayMessage verb for the jamf binary.

In your script you do a command:

/usr/sbin/jamf displayMessage -message 'There are Apple updates available for you to install'. This will bring up a dialog window with an OK button to clear for the currently logged on user.

For future reference if you have a script that you will run using the jamf binary with Casper Remote, a policy, etc. if you use $3 I believe that gives you the username of the currently logged on user.

Wonder if that helps out your issue?

Craig Ernst
Systems Management and Configuration
+-------------------+
University of Wisconsin-Eau Claire
Learning and Technology Services
105 Garfield Ave
Eau Claire, WI 54701
Phone: (715) 836-3639
Fax: (715) 836-6001
+-------------------+
ernstcs at uwec.edu
________________________________________
From: casper-bounces at list.jamfsoftware.com [casper-bounces at list.jamfsoftware.com] On Behalf Of Nichols, Jared [jared.nichols at ll.mit.edu]
Sent: Friday, February 27, 2009 8:24 PM
To: Casper List
Subject: [Casper] Running script as current user

Hi-

Is there a way to run a script as the currently logged in user instead of root?  What I want to do is have the software update background check run, do the auto download and then prompt the user that updates are ready for install.  I can do this with a script that runs:

cd /System/Library/CoreServices/Software\ Update.app/Contents/Resources/
./SoftwareUpdateCheck

But, only if you run it as the logged in user.  If you run it as root with the agent (or just a sudo on the command line) it’s no different than just popping up Software Update and watching it scan for updates.  I know it’s a minor difference, but I like attention to detail :)

I thought about using sed to pull the current user name from the output of

ls -l /dev/console

And then assigning that to a variable and using sudo –u but I’m not a sed wiz.

Is this the right approach or is there a better way?
---
Jared F. Nichols
Desktop Engineer, Infrastructure and Operations
Information Services Department
MIT Lincoln Laboratory
244 Wood Street
Lexington, Massachusetts 02420
781.981.5436



More information about the Casper mailing list