Hello all. new to the forums. Somewhat new to AppleScript as well, I’ve written a handful of simple scripts over the years as a Mac sysadmin.
The script below is my attempt at automating an ssh tunnel with port forwarding, asking the user to enter appropriate credentials (their home Mac admin password for sudo, then their server credentials for the SSH connection) which are then passed to the shell script. I’m running into the following error:
Here is the script… (I zeroed out the IP addresses)
--This is the username and password for the machine the Mac the user is on, presumably their home Mac.
display dialog "Please enter your home Mac's username:" default answer ""
set the homeID to the text returned of the result
display dialog "Please enter your home Mac's password:" default answer "" with hidden answer
set the homePass to the text returned of the result
--This is the username and password for the SSH session - their AD credentials.
display dialog "Please enter your Window's domain username:" default answer ""
set the netID to the text returned of the result
display dialog "Please enter your Window's domain password:" default answer "" with hidden answer
set the netPass to the text returned of the result
set workMac to "000.000.000.000"
set myVPN to "echo " & netPass & " | ssh -N -f -L 77:" & workMac & ":5900 " & netID & "@000.000.000.000"
do shell script myVPN user name homeID password homePass with administrator privileges
The shell script works fine, and as you can see from port 5900, this is intended to forward the VNC port on their work machine, to their local machine port 77 (or any nonessential port). After this connection is established, they connect to localhost:77, and they have control over their work machine.
Any ideas on the ssh ask-pass error? Thanks!
-Brian