Background: I have a quite a few Macs all which require a different admin password. Fortunately, that password does not change so I have written the password into the file .LoginPass.txt. To softwareupdate all the computers at once using Apple Remote Desktop, I’ve been using the command:
cat /Users/.LoginPass.txt | softwareupdate --list
Since the update to Snow Leopard, the command above no longer works. Instead, I get the error “sudo: no tty present and no askpass program specified”. I have found out that this error is the result of a change to the sudo command that Snow Leopard installs. It has to do with the new options -A and -S; use “man sudo” to see these new options and read about them.
The solution is not as pretty but you have to load the contents of .LoginPass.txt into a variable and then, with a combination of the echo and eval command, tell the computer to run softwareupdate. The code is:
FILENAME=“/Users/.LoginPass.txt”
while read line
do echo test
echo $line
done < $FILENAME
eval “echo $line | sudo -S softwareupdate --list”
The first 5 lines load the password from the file .LoginPass.txt into the variable $line. Then, the softwareupdate command can be issued as superuser as well as the password properly submitted.
Rob Stokes
ASSURED SOLUTIONS
Emergency Help Line: 214-747-9911
Information/Report Line: 214-747-4411
http://www.idigmedia.com/thumbnail-gallery/Macintosh-Hosting.html
“Helping our clients increase productivity through measured performance.”