Skip to main content
Question

"Run Command" as logged user within Advanced window of policy


Forum|alt.badge.img+10

Hello,
Is there a way I can directly run a one-line command as the logged in user instead of root within "Advanced" window of policy setup ?

I checked the Admin guide but could not find anything about it.

Many thanks for your help!
Ciao
Carlo

3 replies

Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • April 6, 2011

You can script it, or you can use a user agent, which will run as the user as well.


  • 0 replies
  • April 6, 2011

I've been known to use "su" for this purpose:

su <user> -c "command arg1 arg2 arg3"

Be very careful about quotes and shell escapes in the command.


Forum|alt.badge.img+12
  • Contributor
  • 529 replies
  • April 6, 2011

If you are after a one liner, try something like this:

for myUser in $(stat -f%Su /dev/console); do su $myUser -c 'ls -al'; done

Haven't tested it through the Casper Advanced Window, but I see no reason why it shouldn't work. I imagine the shell type would be appropriate.

Sean


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings