Skip navigation

Remote Login Problem; Name/Password dialogue box not active after sleep

2346 Views 11 Replies Latest reply: Nov 19, 2013 2:56 PM by Pizzy RSS
*Dan* Calculating status...
Currently Being Moderated
Jan 3, 2013 3:46 AM

Hello,

 

I hope someone out there can help me with this one. I manage a lab of Mac Pros and have used the UNIX command below to login to remotely.

 

osascript -e 'tell application "System Events" to keystroke "name"'; \

osascript -e 'tell application "System Events" to delay 2.0'; \

osascript -e 'tell application "System Events" to keystroke keystroke return'

osascript -e 'tell application "System Events" to keystroke "password"'; \

osascript -e 'tell application "System Events" to delay 0.5'; \

osascript -e 'tell application "System Events" to keystroke return'

 

This has worked fine until I upgraded to Mountain Lion. It seems that when the Mac have been asleep and I've woken them with ARD no input window (name/password) is selected.

Screen Shot 2013-01-03 at 11.41.08.png

The only way am able to activate the Name dialogue box is either by clicking manually on the login window or restarting the Mac.

 

I'd tried adding a mouse click with the following command;

osascript -e 'tell application "System Events" to click at {10, 10}'; \

 

This fails.

 

Is there a way in which I can ensure the Name dialogue box is alway active or sucessfully simulate a mouse click and run the login command?

 

Thanks very much in advance,

 

Dan

Mac Pro, Quad-Core Intel Xeon 2.26 GHz, Mac OS X (10.6.1)
  • varjak paw Level 10 Level 10 (167,130 points)

    Try this version; it works on my 10.8 systems (the duplicated "return" line is deliberate):

     

    osascript <<EOF

              tell application "System Events"

                        keystroke "<username>"

                        keystroke tab

                        delay 0.5

                        keystroke "<password>"

                        delay 0.5

                        keystroke return

                        keystroke return

              end tell

    EOF

     

    Be sure to send the command as root.

     

    Regards.

  • varjak paw Level 10 Level 10 (167,130 points)

    You do have your systems set to require name and password, not to a list of names, yes? If so, sorry, I'm not sure what to suggest. I'm not sure why your systems come up from sleep without the cursor in the appropriate field.  I know of no way to script a click into a specific screen area, and my systems come up from sleep with the cursor in the Name field so it hasn't been a problem for me.  Perhaps someone else here will have a thought.

     

    Regards.

  • Antonio Rocco Level 6 Level 6 (10,095 points)

    Hi Dan

     

    The instructions varjak lists have always worked for me regardless of what OS I've used them on - 10.5, 10.6, 10.7 and 10.8 and when waking from sleep.

     

    I wonder if there's something else going on? Do you have 3rd-party software installed that may be contributing to the problem? What happens if you uninstall/remove anything that did not come pre-installed?

     

    Just a suggestion but you could try creating another admin user, logging in with it, deleting the previous admin user (back up any important data first) and trying again.

     

    If you have a spare mac handy that you can wipe and reinstall the base OS do you still see the same symptom?

     

    HTH?

     

    Tony

  • Joe Pyrdek Level 1 Level 1 (135 points)

    No answer but I also have the same problem and I just want to keep this thread in my active watch list in case someone does comes up with a useable answer. 

     

    In my case I can login as either a local admin or even as systems administrator BUT only if i try this immediatly after a restart.  If the computer has a chance to sit idle for more than a few minutes, well, the login username and password box are no longer active and a restart is needed again.

  • pgsengstock Calculating status...

    I'm seeing this in one of my labs, too.  I have BootPicker installed, but don't have a Windows parition deployed yet, so I thought that was it.  It's not.

     

    I, too, have to click anywhere on the screen for the script to work, but that's just not feasible for an entire lab.

  • pgsengstock Level 1 Level 1 (0 points)

    Update (not working, just more info)...

     

    The post here got me a little further:

    http://jamfnation.jamfsoftware.com/discussion.html?id=5560

     

    touch /private/var/db/.AccessibilityAPIEnabled

    osascript -e <<EOF 'tell application "System Events"

    tell process "SecurityAgent"

    set value of text field 1 of window "Login" to "testing"

    set value of text field 2 of window "Login" to "testing"

    end tell

    tell application "system events" to keystroke return

    tell application "system events" to keystroke return

    end tell'

    EOF

     

    The only oddity for 10.8 seems to be that fields 1 and 2 are the inverse of what you'd expect.

     

    touch /private/var/db/.AccessibilityAPIEnabled

    osascript -e <<EOF 'tell application "System Events"

    tell process "SecurityAgent"

    set value of text field 1 of window "Login" to "PASSWORD"

    set value of text field 2 of window "Login" to "USERNAME"

    end tell

    tell application "system events" to keystroke return

    tell application "system events" to keystroke return

    end tell'

    EOF


    Have not tested this with 10.7.  Unfortunately, while it fills the fields, it still doesn't work, because the call to "system events" requires that the mouse have been clicked.

  • Pizzy Calculating status...

    Hi everyone!  Thanks for all of these suggestions.

     

    We have the exact same issue. It's definitely caused after the screen saver comes on.  When we run our Unix commands to login, the mouse needs to be clicked first before the cursor appears.

     

    Has anyone found a workaround yet?  This is a strange one!  I wish we could just make the mouse click through a command!

     

    Any solutions?  Thanks in advance.

  • pgsengstock Level 1 Level 1 (0 points)

    I haven't made any headway on this.  Thankfully I have some great student helpers, so I've been able to send them around to log in and make any local changes that I'd normally do via ARD.  It would still be great to script it.

  • Pizzy Level 1 Level 1 (0 points)

    Thanks Pgsengstock!  I think we may just have to cancel out using the screen saver. We noticed it doesn't happen after a SLEEP.  Only after the screen saver has come on.  Ah well.  Thanks again for your help!

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.