Running a script that will execute on another active user ...

Hello,

Can I from one user, run a script that will execute in another active and not passworded user ??? Mission impossible ??? :/:/:confused:

Thanks in advance.

Model: iMac G5 1.6 MHZ - 2GB
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Assuming the “runner” is an admin and the “other user” is not, possibly; but how are you both using the box at the same time? Is this a fast user switching situation?

Hi,

I haven’t tested it yet, but it should be possible with AppleScript’s remote applications,
using a different User ID on the same computer instead of a remote machine.

Hello,

Excuse for not having answered rapidly. I did not receive a notice of your reply in my email. I was just wondering why I did not have any answer, and I found that there was 2 replies. I will have to check what is wrong with my account.

I want to execute a script in a «non-admin» user but triggering it from an «admin user». I want to run my Indigo application (to control the lightning of my house) from a GUEST user (always open and a non-admin user), and not from my personnal user (ME) that is private and that has admin permissions. Ideally, I would like to run the Indigo app directly from ME user but execute it in the GUEST user. Because I thought that it was not possible to do so, I want to use the script to do specific task for me in the Guest user environnement.

Is my goal clear enough ?? I thank you for your help.

Robert Lespérance

Model: iMac G5 1.6 MHZ - 2GB
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

This works on my machine with a non admin user and a script saved as application,
when asked for username/password type in also the admin data

property host_name : host name of (system info)
property user_name : "" -- admin username
property pass_word : "" -- admin password
property uid : "503" -- user id of remote user
set s to "eppc://" & user_name & ":" & pass_word & "@" & host_name & "/Finder?uid=" & uid
using terms from application "Finder"
	tell application s to open application file "myApp.app" of desktop
end using terms from

PS: Apple Remote Events must be enabled in System Preferences > Sharing

Here’s an example of using sudo to run an application as another (not necessarily logged-in) user.
You’ll need to change the first two lines to what you require.

property shortUserName : "stevejobs"

set appPath to "/Applications/Safari.app/Contents/MacOS/Safari"
do shell script "sudo -u " & shortUserName & space & appPath & " > /dev/null 2>&1 &"

P.S.
If you set shortUserName to be system attribute “USER”, you can run multiple clones of any app as yourself.

Nothing the matter with your account, RL; In this forum subscribing to a topic is opt-in, not automatic. The link is at the bottom of the topics and a check box on a post form.