Useful Short Command Line scripts…

These short scripts, are a combination of Applescript, and Unix Command Line scripts.  Please feel free to contact me, with any additions…Many of these short scripts are from various sources…  But a large number, are from the Apple Leopard Security Configuration, 2nd Edition, guide…  These are some of the scripts that I have found useful at work, and for quick and easy use from ARD (Apple Remote Desktop).

Installing Apple Updates

To Force the system to download & install all updates from the Apple Software Update Server

# Updating from Internet Software Update Server # ----------------------------------- # Download and install software updates. softwareupdate --download --all --install

To Force the system to download & install all updates from the Apple Software Update Server, on a package by package basis.

# Updating from Internet Software Update Server # Updating Manually from Installer Packages # ----------------------------------- # Download software updates. softwareupdate --download --all # Install software updates. installer -pkg $Package_Path -target /Volumes/$Target_Volume

Running Disk Utility to Repair Disk Permissions via command line

# ----------------------------------- # Repair disk permissions. diskutil repairPermissions /Volumes/$Target_Boot_Drive

Add Access Warnings to the Login Window

sudo defaults write /Library/Preferences/ LoginwindowText “Warning Text

Hide Users below User # 500

sudo defaults write /Library/Preferences/ Hide500Users -bool YES

Force a Users Password to be Changed.

# Change an account’s password. # Don’t use the following command on a computer that could possibly have # other users logged in simultaneously.

sudo dscl . passwd /Users/$User_name $Oldpass $Newpass

Remove Password hints.

defaults write /Library/Preferences/ RetriesUntilHint -int 0

Display Name & Password in Login Window

# Set the login options to display name and password in the login window.

defaults write /Library/Preferences/ SHOWFULLNAME -bool yes

Disable the Restart, Sleep and Shutdown Buttons in Login Window

# Disable Show the Restart, Sleep, and ShutDown Buttons. defaults write /Library/Preferences/ PowerOffDisable -bool yes

Disable Fast User Switching

defaults write /Library/Preferences/.GlobalPreferences MultipleSessionEnabled -bool NO

Disable Recent Applications

# ----------------------------- # Disable display of recent applications. defaults write Applications -dict MaxAmount 0

Securing Desktop & Screen Saver Preferences

# Set idle time for screen saver. XX is the idle time in seconds. defaults -currentHost write idleTime -int XX