{"id":1152,"date":"2009-09-29T13:52:13","date_gmt":"2009-09-29T17:52:13","guid":{"rendered":"http:\/\/www.schollnick.net\/wordpress\/?page_id=1152"},"modified":"2010-11-08T14:30:00","modified_gmt":"2010-11-08T18:30:00","slug":"useful-short-command-line-scripts","status":"publish","type":"page","link":"http:\/\/www.schollnick.net\/wordpress\/macintosh-related\/useful-short-command-line-scripts\/","title":{"rendered":"Useful Short Command Line scripts&#8230;"},"content":{"rendered":"<p>These short scripts, are a combination of Applescript, and Unix Command Line scripts. \u00c2\u00a0Please feel free to contact me, with any additions&#8230;Many of these short scripts are from various sources&#8230; \u00c2\u00a0But a large number, are from the\u00c2\u00a0<a href=\"http:\/\/images.apple.com\/server\/macosx\/docs\/Leopard_Security_Config_2nd_Ed.pdf\">Apple Leopard Security Configuration, 2nd Edition<\/a>, guide&#8230; \u00c2\u00a0These are some of the scripts that I have found useful at work, and for quick and easy use from ARD (Apple Remote Desktop).  [toc=&#8221;2,3&#8243; title=&#8221;Table of contents&#8221;]  <strong>Installing Apple Updates<\/strong><\/p>\n<hr \/>\n<p>To Force the system to download &amp; install all updates from the Apple Software Update Server<\/p>\n<p style=\"padding-left: 30px;\"><code># Updating from Internet Software Update Server # ----------------------------------- # Download and install software updates. softwareupdate --download --all --install<\/code><\/p>\n<hr \/>\n<p>To Force the system to download &amp; install all updates from the Apple Software Update Server, on a package by package basis.<\/p>\n<p style=\"padding-left: 30px;\"><code># 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<\/code><\/p>\n<hr \/>\n<h2>Running Disk Utility to Repair Disk Permissions via command line<\/h2>\n<p style=\"padding-left: 30px;\"><code># ----------------------------------- # Repair disk permissions. diskutil repairPermissions \/Volumes\/$Target_Boot_Drive <\/code><\/p>\n<p style=\"padding-left: 30px;\">\n<hr \/>\n<h2>Add Access Warnings to the Login Window<\/h2>\n<p style=\"padding-left: 30px;\"><code>sudo defaults write \/Library\/Preferences\/com.apple.loginwindow\u00c2\u00a0LoginwindowText \u00e2\u20ac\u0153<em>Warning Text<\/em>\u00e2\u20ac\u009d <\/code><\/p>\n<hr \/>\n<h2>Hide Users below User # 500<\/h2>\n<p style=\"padding-left: 30px;\"><code>sudo defaults write \/Library\/Preferences\/com.apple.loginwindow Hide500Users -bool YES<\/code><\/p>\n<p style=\"padding-left: 30px;\">\n<hr \/>\n<h2>Force a Users Password to be Changed.<\/h2>\n<p style=\"padding-left: 30px;\"><code># Change an account\u00e2\u20ac\u2122s password. # Don\u00e2\u20ac\u2122t use the following command on a computer that could possibly have # other users logged in simultaneously.<\/code><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"font-family: monospace;\">sudo dscl . passwd \/Users\/$User_name $Oldpass $Newpass<\/span><\/p>\n<p><code> <\/code><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"font-family: -webkit-monospace;\"> <\/span><\/p>\n<hr \/>\n<h2>Remove Password hints.<\/h2>\n<p style=\"padding-left: 30px;\"><code> defaults write \/Library\/Preferences\/com.apple.loginwindow RetriesUntilHint -int 0 <\/code><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"font-family: -webkit-monospace;\"> <\/span><\/p>\n<hr \/>\n<h2>Display Name &amp; Password in Login Window<\/h2>\n<p><code># Set the login options to display name and password in the login window.<\/code><\/p>\n<p style=\"padding-left: 30px;\"><code> defaults write \/Library\/Preferences\/com.apple.loginwindow SHOWFULLNAME -bool yes <\/code><\/p>\n<p style=\"padding-left: 60px;\"><span style=\"font-family: -webkit-monospace;\"> <\/span><\/p>\n<hr \/>\n<h2>Disable the Restart, Sleep and Shutdown Buttons in Login Window<\/h2>\n<p style=\"padding-left: 30px;\"><code># Disable Show the Restart, Sleep, and ShutDown Buttons. defaults write \/Library\/Preferences\/com.apple.loginwindow PowerOffDisable -bool yes <\/code><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"font-family: -webkit-monospace;\"> <\/span><\/p>\n<hr \/>\n<h2>Disable Fast User Switching<\/h2>\n<p style=\"padding-left: 30px;\"><code>defaults write \/Library\/Preferences\/.GlobalPreferences MultipleSessionEnabled -bool NO <\/code><\/p>\n<p style=\"padding-left: 30px;\">\n<hr \/>\n<h2>Disable Recent Applications<\/h2>\n<p style=\"padding-left: 30px;\"><code><span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;\"> <\/span> # ----------------------------- # Disable display of recent applications. defaults write com.apple.recentitems Applications -dict MaxAmount 0 <\/code><\/p>\n<p style=\"padding-left: 30px;\">\n<hr \/>\n<h2>Securing Desktop &amp; Screen Saver Preferences<\/h2>\n<p style=\"padding-left: 30px;\"><code># Set idle time for screen saver. <em>XX<\/em> is the idle time in seconds. defaults -currentHost write com.apple.screensaver idleTime -int <em>XX<\/em><\/code><\/p>\n<p><em> <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These short scripts, are a combination of Applescript, and Unix Command Line scripts. \u00c2\u00a0Please feel free to contact me, with any additions&#8230;Many of these short scripts are from various sources&#8230; \u00c2\u00a0But a large number, are from the\u00c2\u00a0Apple Leopard Security Configuration, 2nd Edition, guide&#8230; \u00c2\u00a0These are some of the scripts that I have found useful at <a class=\"read-more\" href=\"http:\/\/www.schollnick.net\/wordpress\/macintosh-related\/useful-short-command-line-scripts\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":218,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"_links":{"self":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/pages\/1152"}],"collection":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/comments?post=1152"}],"version-history":[{"count":0,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/pages\/1152\/revisions"}],"up":[{"embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/pages\/218"}],"wp:attachment":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/media?parent=1152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->