Log into OSX via the command line [closed] Log into OSX via the command line [closed] unix unix

Log into OSX via the command line [closed]


What about something like this:

#!bin/shcat >/tmp/Login_Automatically.sh <<-"EOF"if [[ "$(who | grep console)" == "" ]]; then # Runs ONLY if no one is logged inosascript <<EOTset username_ to "username"set password_ to "password"tell application "System Events"

(via http://hints.macworld.com/article.php?story=2010021119293586)

Also, can't you disable the authentication all together in the system preferences if you want a way to bypass the login?

Or if you want to kill it read:Kill "loginwindow" process using command line in Mac OS X


The solution was in the comments of this article.

Copy and paste into Command Line/ARD:

osascript -e 'tell application "System Events" to keystroke "usernamegoeshere"'; \osascript -e 'tell application "System Events" to keystroke tab'; \osascript -e 'tell application "System Events" to keystroke "passwordgoeshere"'; \osascript -e 'tell application "System Events" to keystroke return'

Thanks to Sam Mirrado for providing the link to the article.

Source. Comment by engelby on Feb 16, '10 02:09:32PM.