Automator: Command Line: Password Response?

Joined
May 12, 2006
Messages
5
Reaction score
0
I would like to use automator to automate some lengthy command lines for users who would rather not go there...

The process I need to call needs root or sudo... so the call would be like this... for a non-root user (usual)

sudo /opt/vintela/vmx/bin/vmxclienttool --run-software-distribution

Of course, this fails -- and I assume it's because the shell is now asking for the password in order to run sudo...

Is there any way to get this kind of interactivity? Or am I hoping too much?

Thanks in advance for any advice!

--VorpalBlade
 

Ric

Joined
May 14, 2004
Messages
4,245
Reaction score
5
Hi there and welcome,

to use sudo you will have to supply the admin password...throw this into AppleScripts Script editor...

Code:
do shell script "sudo /opt/vintela/vmx/bin/vmxclienttool --run-software-distribution" password "yourAdminPassword" with administrator privileges

If you change the "yourAdminPassword" to the actual password then throw that line into Script editor save it as an Application, then it will stop prying eyes 'see' the password, but it will run...

regards

Ric
 

Ric

Joined
May 14, 2004
Messages
4,245
Reaction score
5
No problem,

off to sleep any problems leave a note !

Should look like this:

MayScriptEditor001.jpg


MayScriptEditor002.jpg


MayScriptEditor003.jpg


regards

Ric
 
Joined
May 12, 2006
Messages
5
Reaction score
0
Another question if I may...

This command, when successful, (or not actually) writes a line or so as output... I was thinking I might capture and show that -- Does applescript support returning something to the GUI?
 
Joined
May 12, 2006
Messages
5
Reaction score
0
I see this will work in the Script Editor -- didn't realize that... (what comes on standart out I mean)

I'd like to have it show up in the scirpt GUI when pressing a "go" button, guess I'll have to do some research...
 
Joined
Jan 16, 2008
Messages
1
Reaction score
0
Hi

I'm trying to do this using a different command and I'm not sure what's the problem, but I can't get it to work. Is it because that folder name has space in it?
(OS 10.5.1)

do shell script "sudo /Library/Application Support/VMware Fusion/boot.sh --restart" password "pass" with administrator privileges

Where pass is my admin password. Using that password I can run script in terminal.
Thanks...

____________
Tomi Toivonen
 

Ric

Joined
May 14, 2004
Messages
4,245
Reaction score
5
Hi there,

yes, you need to 'escape' the space...

Code:
do shell script "sudo /Library/Application\ Support/VMware Fusion/boot.sh --restart" password "pass" with administrator privileges

Try this...

Add a forward slash before the space.

regards

Ric
 
Joined
Jun 8, 2008
Messages
1
Reaction score
0
I need to do something similar except, I need to ask the user for their password and use that on the commandline.

Baiscaly, what I want to do is the following:

I have an automator workflow to copy user selected folders to the correct folder.
After that, just to be sure I want to execute the following commands:

Code:
cd /someFolder
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

find though seems to not like this unless run as a sudo'er.
No clue as to why because when not run though find, just manual chmod I don't get a permission denied from the terminal.

So I was wondering, how do I actually prompt the user for their password and then use that input to run the above commands, or even better, how do i recursively chmod the files and folders in such a way that find isn't necessary / prompts for a password?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top