How to open SSH socks proxy at startup? I use remote socks proxies for occasions when I need an IP from various locations.  There is one that I use far more than any others, to the point that I would like a connection to be opened by default when my client machine boots.

Currently I have to open terminal, execute an SSH -D command, type in a password, and then the proxy is live.  I would really like to automate this at startup somehow, but I can't seem to figure out how to do it.  I'm intermediate with CLI stuff but a novice with shell scripting and so forth, so I really don't even know where to begin.

Is there an easy way to have this SSH connection start automatically at client startup?

So far in my searching for a solution, I have found this and am running as an automator workflow using the Run Shell Script module:

ip=aa.bb.cc.dd   #replace with your unix server's ip
username=yyyyyyyyyy #your ssh username
password=xxxxxxxxxxxxxxxxx #your ssh password
command=ssh -D 2002     #what do you want to do with remote server
arguments=-Cq     #arguments for your command
expect -c 'spawn ssh $username@$ip ; expect password ; send "$password\n" ; interact'


It seems to work, in that Automator gives no errors and reports Workflow completed.  However the proxy is not accessible from a browser, so clearly something is wrong.

I'm using Mavericks, latest updates.
You need to pass the arguments to the ssh command you are running, not to some variables:

ip=aa.bb.cc.dd   #replace with your unix server's ip
username=yyyyyyyyyy #your ssh username
password=xxxxxxxxxxxxxxxxx #your ssh password
command="ssh -D 2002"     #what do you want to do with remote server
arguments=-Cq     #arguments for your command
expect -c 'spawn $command $arguments $username@$ip ; expect password ; send "$password\n" ; interact'