Terminal - how to log in SuperUser with Standard User

I make an AppleScript to do some line code in Terminal.
Work great in my Admin User, but not in other User (standard).

Terminal calls … Acces denied…

Why ? I call the command line with and Admin Password.
HOW to log in Super User (or admin user) in a Standars user interface ?

Please help !!


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

You’re getting a little confused between your terminal scripting, ‘do shell script’ and sudo.

None of the commands in your example (except for the activate) actually targets terminal.app.

‘do shell script’ is the built-in standard command for executing shell commands. It doesn’t require (or even use) terminal.app but runs the command directly.

If you want to use terminal.app you should use the ‘do script’ command instead (but you shouldn’t need to use terminal.app in this instance).

So, given that you’re using ‘do shell script’, you can eschew all the ‘sudo’ because it’s irrelevant. ‘with administrator privileges’ takes care of the authentication and elevated privileges.

So your script should look more like:

do shell script "my commande line in terminal" password adminPass with administrator privileges 

Thank Camelot for your support.

My big problem…

This Script is made for deleting specific files in the system/library

I need to be able to run this script on Mac who have Multiple Users (at work) (on every user type, Admin or not)

On the Admin user, it works fine, but on other standard users (non administrator’s privilege), the script doesn’t work. I think it doesn’t recognize the admin password.

And…
If i tried to run the command line with Terminal
(do script “rm -f /System/Library/Caches/xxxxx” password adminPass with administrator privileges) the Terminal doesn’t recognize the admin password ? And this with or without an Admin User interface??

Can you help me ?


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]