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


Click here to return to the 'Remote GUI login via Apple Remote Desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Remote GUI login via Apple Remote Desktop
Authored by: nukethis on Jul 28, '05 03:10:18PM

So, I know this hint works via ssh via sudo. Knowing this, can someone write a applescript or some sort of unix script that ssh's into one machine, do the command, then goes to the next machine? Say 20 machines start at 192.168.80.2 and end at 192.168.80.21 . So basically bypassing Apple Remote Desktop.



[ Reply to This | # ]
Remote GUI login via Apple Remote Desktop
Authored by: tomtux on Aug 05, '05 01:52:35AM

[code]
#!/bin/sh
ssh root@192.168.80.2 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.3 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.4 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.5 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.6 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.7 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.8 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.9 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.10 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.11 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.12 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.13 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.14 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.15 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.16 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.17 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.18 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.19 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.20 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
ssh root@192.168.80.21 osascript -e 'tell application "System Events"' -e 'keystroke "LOGIN_NAME"' \
-e 'keystroke tab' -e 'delay 0.5' -e 'keystroke "PASSWORDHERE"' -e 'delay 0.5' -e 'keystroke return' -e 'end tell'
[/code]
It is probably helpful if the root user on all of the lab machines have their private key copied to the place where this script is going to be used in the .ssh/authorized_keys. Although its a security risk you may not wish to use a passphrase so you don't have to keep inputting the root user of each machine.



[ Reply to This | # ]
Remote GUI login via Apple Remote Desktop
Authored by: cpbaldwin on Oct 14, '05 09:59:09AM

ah, figured it out! First, I have to include the path to the comand I want run. Second, there is problem sometimes with calling muliple commands, so I had to put the command in a string to get it to work.

#!/bin/bash

COMPUTERS=0
IPADDR="192.168.80."
STARTIP=2
COM1="/usr/bin/osascript -e 'tell application "System Events" to keystroke "USERNAME"';/usr/bin/osascript -e 'tell application "System Events" to keystroke tab';/usr/bin/osascript -e 'tell application "System Events" to delay 0.5';/usr/bin/osascript -e 'tell application "System Events" to keystroke "PASSWORD"';/usr/bin/osascript -e 'tell application "System Events" to keystroke return'"
i=0
clear

while [ $i -le "$COMPUTERS" ]
do

echo "Logging into..."$IPADDR$startip

ssh root@$IPADDR$STARTIP $COM1

i=$(($i+1)) #this is for the loop counter
startip=$(($startip+1)) #this sets the ip address

done

exit 0



[ Reply to This | # ]
Remote GUI login via Apple Remote Desktop
Authored by: cpbaldwin on Oct 14, '05 11:57:15AM

Oh, I forgot to change something for nukethis. the Variable COMPUTERS needs to be changed from 0 to 20 for the number of computers you have.



[ Reply to This | # ]