Stooovie Posted May 20, 2019 Share Posted May 20, 2019 Hi, I’d LOVE an option in Alfred to launch apps as admin (=with sudo). For example, some file managers like Forklift or Marta don’t run as admin by default, making them less than ideal for my needs. I know I can do this in terninal, but I’d love to be able to do this in Alfred, preferably with modifier key (i.e. "hold Opt to run as admin“). Any tips? Thanks! Link to comment
vitor Posted May 20, 2019 Share Posted May 20, 2019 15 hours ago, Stooovie said: For example, some file managers like Forklift or Marta don’t run as admin by default I find that weird, and that seems like a bad decision. It also seems unlikely that option will ever be added to Alfred. Very few people would want it, and it gives users an easy way to shoot themselves in the foot. 15 hours ago, Stooovie said: I know I can do this in terninal You don’t need a terminal, you just need a Run Script Action. Link to comment
Stooovie Posted May 21, 2019 Author Share Posted May 21, 2019 Thanks! Just one thing - how do I pass my root (admin) password so I don’t have to enter it manually upon invoking the command? TY EDIT: I’m just using the Terminal command action to do this, with a simple "sudo -b /Applications/Marta.app/Contents/MacOS/Marta" Link to comment
deanishe Posted May 21, 2019 Share Posted May 21, 2019 2 minutes ago, Stooovie said: how do I pass my root (admin) password You don't because that would be very bad from a security perspective. Either you use AppleScript: do shell script "/Applications/Marta.app/Contents/MacOS/Marta" with administrator privileges Or you edit your sudoers configuration, so you don't need to enter your password to use sudo. The former is a better idea, security-wise. Link to comment
Stooovie Posted May 21, 2019 Author Share Posted May 21, 2019 (edited) Brilliant, the Applescript way is just what I needed, thanks! Case closed Edited May 21, 2019 by Stooovie Link to comment
vitor Posted May 21, 2019 Share Posted May 21, 2019 1 hour ago, deanishe said: You don't because that would be very bad from a security perspective. Still, it is possible (even if a terrible idea) with sudo --stdin /Applications/Marta.app/Contents/MacOS/Marta <<< PASSWORD_HERE. Stooovie 1 Link to comment
gingerbeardman Posted February 27, 2023 Share Posted February 27, 2023 (edited) Old thread but useful information. You can configure askpass and then use sudo -A to automatically get the password from askpass If you want to automatically use your login password, without having to enter it: /usr/local/bin/askpass #!/bin/sh security find-generic-password -a yourusernamegoeshere -s login -w Edited February 27, 2023 by gingerbeardman Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now