Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Remove Safari history files on logout via shell script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Remove Safari history files on logout via shell script
Authored by: pingnak on Sep 15, '09 07:57:06PM

OK, I'm glad I posted this some months back, and came back to visit. There was some excellent feedback waiting. I revisited after upgrading to Snow Leopard and noticed I missed some files.

Now it won't miss any files in the Library/Safari folder. HOWEVER, if Apple ever turns evil and renames the 'Bookmarks.plist' file, this will blow away the 'new' bookmarks, and the script will have to be tweaked.

Now blows away Flash persistent object data, too (and as suspected, quite a bit of it had piled up). Somewhat selective of ONLY content of the SharedObject database. There are other Flash settings that shouldn't be nuked.

Now accepts the username from the parameter for the logout hook, and also allows you to run it on demand (i.e. for testing).

Dyke out whatever frightens you. All I care about are my 'shortcuts', and the rest of the 'convenience' be damned.

[code]
#!/bin/bash

#
# Copy/paste this command and point it at wherever you put this script
# sudo defaults write com.apple.loginwindow LogoutHook "/Users/pingnak/scripts/privacy.sh"
#
# To be complete, Safari->Preferences->AutoFill clear all of the checkmarks (it won't remember passwords and forms).
#
# Script runs as root, so make sure this file is protected from casual modification.
#

if [ -d $useroot=/Users/$1 ]
then
useroot=/Users/$1
else
useroot=~
fi

# Clear Safari History (except for bookmarks).
/usr/bin/find Library/Safari/ -not -name Bookmarks.plist -execdir /bin/rm -rf \{\} \;

# Forget cookies
/bin/rm -f $useroot/Library/Cookies/*

# Forget whatever this stuff is
/bin/rm -rf $useroot/Library/Caches/com.apple.Safari

# Forget Flash plugin persistent 'Shared Objects' settings
/bin/rm -rf $useroot/Library/Preferences/Macromedia/Flash\ Player/#SharedObjects

# Add any additional clean-up here.

[/code]



[ Reply to This | # ]
Remove Safari history files on logout via shell script
Authored by: pingnak on Sep 15, '09 07:59:48PM
And then, naturally, I spot a bug and can't edit it.

#!/bin/bash

#
# Copy/paste this command and point it at wherever you put this script
# sudo defaults write com.apple.loginwindow LogoutHook "/Users/pingnak/scripts/privacy.sh"
#
# To be complete, Safari->Preferences->AutoFill clear all of the checkmarks (it won't remember passwords and forms).
#
# Script runs as root, so make sure this file is protected from casual modification.
#

if [ -d $useroot=/Users/$1 ] 
then 
	useroot=/Users/$1
else
	useroot=~
fi

# Clear Safari History (except for bookmarks).
/usr/bin/find $useroot/Library/Safari/ -not -name Bookmarks.plist -execdir /bin/rm -rf \{\} \;

# Forget cookies
/bin/rm -f $useroot/Library/Cookies/*

# Forget whatever this stuff is
/bin/rm -rf $useroot/Library/Caches/com.apple.Safari

# Forget Flash plugin persistent 'Shared Objects' settings 
/bin/rm -rf $useroot/Library/Preferences/Macromedia/Flash\ Player/#SharedObjects

# Add any additional clean-up here.



[ Reply to This | # ]