Mac Help Forums


Reply
Thread Tools Display Modes

Automator: Command Line: Password Response?

 
Member
Join Date: May 2006
Posts: 5
 
      12th May 2006
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
 
Reply With Quote
 
 
 
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      12th May 2006
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
 
Reply With Quote
 
Member
Join Date: May 2006
Posts: 5
 
      12th May 2006
Cool -- thank you very much!

Trying now...
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      12th May 2006
No problem,

off to sleep any problems leave a note !

Should look like this:







regards

Ric
 
Reply With Quote
 
Member
Join Date: May 2006
Posts: 5
 
      12th May 2006
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?
 
Reply With Quote
 
Member
Join Date: May 2006
Posts: 5
 
      12th May 2006
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...
 
Reply With Quote
 
Member
Join Date: May 2006
Posts: 5
 
      12th May 2006
Found it...

display dialog result

I knew I'd seen this about a year ago...

Thanks again!
 
Reply With Quote
 
New Member
Join Date: Jan 2008
Posts: 1
 
      16th January 2008
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
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      18th January 2008
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
 
Reply With Quote
 
New Member
Join Date: Jun 2008
Posts: 1
 
      8th June 2008
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?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextMate, adding a new command, Linux command line Q Justin C UK Macs 2 16th July 2010 10:32 AM
Command-line VNC DJ Craig Apps 3 24th June 2006 07:26 PM
pgp or gpg for OS X. Where is command line? John N. Alegre Mac 7 13th June 2004 07:46 AM
Command-line command Serveradmin Benu Mac 1 25th April 2004 12:20 AM
command line in OS 8.5 Sascha Wostmann Mac 2 3rd July 2003 03:50 PM


All times are GMT +1. The time now is 11:58 PM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
Yikes! Teacher needs help!
Mollyc4627 (3 Hours Ago, 08:57 PM)

Unable to log in to websites
AMonty20 (6 Hours Ago, 05:52 PM)

Add Different Speech Commands
bae_22 (7 Hours Ago, 04:40 PM)

Login (2 macs) passwords spontaniously changed?
Roger Vaught (8 Hours Ago, 03:31 PM)

Best car charger or inverter for Macbook Pro?
imeme87 (8 Hours Ago, 03:22 PM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51