enter log and password for Terminal in a script

Hi
i have to perform few command in Terminal. (in admin or standard user)

i have to:
1-open Terminal
2-log in root (or admin identitie)
3-send the password
4-perform command lines

My big problem is … i don’t know how to give my Password when i ask to log in root mode in the Terminal.

Thanks


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

Hi
this is my progress…

now i am able to log in Root and give the Root’s password to the terminal.
But after, my (4) command “do script” appear in other window (not in the root log window).

My command lines do insert in the SAME window of root’log.

thank for your help

Open the AppleScript “Untitled” in a new Script Editor window.


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

Do you need to use Terminal.app at all? can’t the commands just be run in a shell without terminal.app?

If so, just use the system-level ‘do shell script’ and do away with terminal.app altogether:

do shell script "blah; blah2; blah3" with administrator privileges password "blahblah"

If you omit the ‘password “blahblah”’ part the system will prompt you for your password to authenticate before performing the commands.

Hi Camelot
thank for your help.

Yes i think i need to use the Terminal because we need (at work) to perform this script on all Standard Accounts on the Mac (without permissions to Read-Write on these files). (we have few Mac with one Admin Account and many Standard Accout to many employees)

With “Do Shell script” we need to be in Administrator Account (or root) to run these commands. The only way i see to run commands with Standard Account (Standard User), it’s with Terminal.app., login root user (in Terminal), enter root password and perform commands.

I f you see my precedent message with my code), i am able to log in root in Terminal.app, enter my root’s password (i don’t know if it’s the best way… keystroke blahblah), but when i write again “do script”, Terminal.app open an other window… not log in root… whitout privileges…

Please !!! help !!!

Thanks