3

Is there a Terminal command or script that will close an app running under another user? I’d rather close than kill, but if not possible, kill would work, too.

  • 1
    Welcome to Ask Different! :) I hope you come to find this site has a lot to offer! In case you haven't already, it's worth taking the time to read the tour. All the best! – Monomeeth Jan 5 at 22:48
  • Are you an admin user? – Mark Jan 5 at 22:59
  • I am, but I want this to be run from a non-admin user. I want to use a script or maybe Automator could perform it. I know it’s going to need some admin permission to do. – Scott Jan 6 at 2:23
  • 2
    An non-admin can only control their own processes. This cannot be changed. – John Keates Jan 6 at 6:35
3

You cannot control processes you do not own as a non-admin user. If you can run the command as an admin, you can send the quit signal using the killall command for all existing instances of the program and quit the program that way. If you only wish to quit specific program instances you will need a more complex combination of commands.

Granting selective admin rights to non-admin users is possible, but keep in mind that granting process killing rights is universal and the semi-admin user will be able to kill any process. Shell scripting, AppleScript and Automator all derive their access from the same user privileges controls, so using a different tool won’t grant this right in a different way.

-3

You guess the needed command!

# list all running process. It's an old command hence the dash.

#find needed process id.

ps aux

# you need super user powers to effect other users. You will

# need to be on an admin id. type you admin password. no characters

# will be typed. press return.

# be sure to get this right.

# if it doesn't quit, just leave off -s quit to force off the account.

sudo kill -s quit {process number}
  • Thanks, but this would require too much user interaction for what I need, and the user is not on an admin login. Sudo would not work unless it were in a script that automatically entered the sudo password. I guess I should have added that I want this to run when the user logs in (login items). – Scott Jan 6 at 2:32
  • 1
    @Scott please add essential details like this to the question by editing it. It might also help if you provide some context on what is the purpose here. – nohillside Jan 6 at 8:36
  • Sorry for my vagueness, here’s what I’m trying to do. I use ExpressVPN on my account. When my eleven-year-old son signs in on his account, the VPN is still active. He is unable to use certain Minecraft servers with the VPN active, so I have to go back to my log in, and disable the VPN. What I’m trying to do have the VPN disabled automatically when he logs in to his account. – Scott Jan 6 at 21:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .