RunAsCurrentUser.exe equivelent for Mac

(imported comment written by Lee Wei)

You can use the UNIX switch user (su) command.

For example, for a per-command basis, it would be:

su user -c command

A example of an ActionScript (not tested)

delete __appendfile
appendfile #!/bin/sh
appendfile su leewei -c “/usr/bin/some_command”

delete "/tmp/runcommand.sh"
copy __appendfile “/tmp/runcommand.sh”

wait chmod +x "/tmp/runcommand.sh"
wait chown leewei "/tmp/runcommand.sh"
wait “/tmp/runcommand.sh”

Lee Wei

1 Like