Posts RSS Comments RSS 48 Posts and 147 Comments till now

Enabling clear text passwords in Leopard with AppleScript

Note: The method for doing this in Snow Leopard is almost the same but has one slight change to it. Check out the post on doing enabling this in Snow Leopard for the changes.

Leopard, by default, has clear text passwords disabled for AFP connections. This is of course a very good thing to do. No one should be using clear text password connections anymore. However, there are still some older implementations of AFP out there on servers that require a clear text password. So, how do you enable them? By editing a property list or .plist file.

The file in question here is named “com.Apple.AppleShareClient.plist”. It’s located in the Library/Preferences folder in each users home folder. Now, there are a couple of ways to edit this file. If you have the Developer’s Tools installed you can use Property List editor to change that setting from “NO” to “YES”.

Or, if you prefer a command line approach you can use the defaults command to write your settings to the file.

defaults write com.Apple.AppleShareClient afp_cleartext_allow -bool YES

If you’re not sure if clear text passwords are enabled you can use the “read” function in defaults to read the value

defaults read com.Apple.AppleShareClient afp_cleartext_allow

A returned value of “0” means it is disabled. A value of “1” means enabled.

If you have a lot of users that need to have this enabled or even checked that’s a lot of typing. So, once again AppleScript to the rescue.

This script will check the status of clear text passwords on launch. If it’s already enabled it will ask if the user wants to disable it. If it’s not enabled it will ask to enable it.

So, just launching the script will let you see if you need to do anything or not. Saving this an application and emailing it to users is a quick way to have them enable it if they need it and then disable it when the need is over without you having to walk over there and type everything a bunch of times.

If you would prefer to download a pre-complied script file click below:

Leopard Clear Text script

try
	set clearStatus to (do shell script "defaults read com.Apple.AppleShareClient afp_cleartext_allow") as number
on error
	-the first command will throw an error if the afp_cleartext_allow setting does not exist
	-if there is an error we'll assume that the setting isn't there and set our variable to the disabled setting
	set clearStatus to 0
end try
-a status of "1" means it's enabled.  So ask if they want to disable it
if clearStatus is 1 then
	display dialog "Do you want to disable clear text passwords?" buttons {"Cancel", "Disable"} default button 2
	if the button returned of the result is "Disable" then
		do shell script "defaults write com.Apple.AppleShareClient afp_cleartext_allow -bool NO"
		set clearStatus to (do shell script "defaults read com.Apple.AppleShareClient afp_cleartext_allow") as number
		-check to make sure the change really took effect
		if clearStatus is 0 then
			display dialog "Clear text passwords have been disabled" buttons {"OK"}
		else
			display dialog "There was an error disabling clear text passwords!" buttons {"OK"}
		end if
	end if
else
	display dialog "Do you want to enable clear text passwords?" buttons {"Cancel", "Enable"} default button 2
	if the button returned of the result is "Enable" then
		do shell script "defaults write com.Apple.AppleShareClient afp_cleartext_allow -bool YES"
		set clearStatus to (do shell script "defaults read com.Apple.AppleShareClient afp_cleartext_allow") as number
		-check to make sure the change really took effect
		if clearStatus is 1 then
			display dialog "Clear text passwords have been enabled" buttons {"OK"}
		else
			display dialog "There was an error enabling clear text passwords!" buttons {"OK"}
		end if
	end if
end if
Be Sociable, Share!

7 Responses to “Enabling clear text passwords in Leopard with AppleScript”

  1. on 19 Nov 2007 at 6:20 pmAnthony O'Brien

    Thanks for the post, it has been very helpful.

    I am having problems with the applescript though, it comes up with Syntax errors when I try to run it.

    Do you have an application version of the script that you can email to me please.

    Thanks,

    Anthony O’Brien

  2. on 20 Nov 2007 at 8:41 amwebmaster

    Thanks for the information. I did find that copying and pasting the script can cause some syntax errors. I’ve put a downloadable version of the script on the page right before the script.

  3. on 06 Dec 2007 at 9:04 pmcousinvinny

    I tried this and it’s not working. I think I may still have an afp connection going but I don’t know how to check for open connections in Terminal…can you help?

    Thanks,

    Cousin Vinny

  4. on 08 Dec 2007 at 3:41 pmRuss

    Thanks, this Apple Script finally helped as it worked for my Leopard client trying to connect to Tiger Xserve on 10.4.10.

    Before running this script, VPN would connect but I couldn’t connect to the LAN.

    Now looking at Tiger VPN settings to see if I can require tighter password sending…I’m assuming Leopard server inables this by default. But I’m another 6 months off from getting Leopard Server running at our school.

    Appreciate your help!

  5. on 10 Dec 2007 at 6:02 pmM Greene

    I bet this ‘tuned off’ info was in small print somewhere, but I didn’t see it…

    …that you that you did!! And even better that you knew what to do about it….

    and EVEN BETTER that you shared with us… you know, the guys that didn’t see that small print about turning off clear text PWs.

    Outstanding job, you’ve helped us a lot.

    From the middle of the great wide open desert, our little school thanks you!

    Sincerely,

    m greene

  6. on 25 Feb 2009 at 4:41 amLouis

    Thanks a lot!!

    Even better when it’s easy and simple.

    You have helped me a lot.

    Sincerely,

    Louis

  7. [...] Leopard with one very critical difference. The details about how and why are already in my post on Leopard. If you want the background information you should check out that page. This post will only deal [...]

Trackback this post | Feed on Comments to this post

Leave a Reply