Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

do shell script as Root

I have developer tools loaded on my Powerbook and want to turn nap off at start up (avoid the annoying hiss).
I created this script which runs in a terminal but not as a script because I do not know how to enter the root password automatically.

do shell script "hwprefs cpu_nap=false"

This returns message you need to be root so I added

do shell script "sudo hwprefs cpu_nap=false"

But am not sure how to add the password after that.

Thanks for any suggestions

Posted on Nov 3, 2005 9:37 PM

Reply
7 replies

Nov 4, 2005 11:33 AM in response to Steve Herman1

In addition to the warning about including the "admin" password (which will be stored in plain text) in the script, remeber that when a "do shell script ... with administrator privileges" command is run, it uses the method whereby the password is "echoed" and piped to 'sudo -S' which some people consider to be insecure. It potentially allows another user to see the password in plain text with a well timed 'ps -ax' command (at least it does in 10.3.9).

Nov 4, 2005 2:28 PM in response to Camelot

This was changed in later versions of the OS. I'm not exactly sure when the change was made, but it isn't the case on the latest versions of 10.4


Thanks for this information - I'm relieved to hear it!

I only wish they would include these types of security enhancements for versions of the OS prior to the current one for users such as me and the original poster who are still on 10.3, which was still on sale as recently as eight months ago after all...

Nov 4, 2005 2:48 PM in response to biovizier

This may have been a fix that was part of AppleScript in 10.4 but If it was released as part of a Security Update then it should've been included in a 10.3.9 security update as well.

I think Apple's policy (although it may be an "unofficial" policy) is to release security updates for the latest current version of the OS and the last release of the previous version of the OS. So 10.3.9 should continue to receive security updates until 10.5 comes out.

Steve

do shell script as Root

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.