So I have a few scripts to tunnel things over SSH, that read like this:
Apple File Sharing
Plex Media Server
General SOCKS Proxy
iTunes Home Sharing
I have 4 aliases to them in a folder and launch them each as needed, and each opens them in a terminal window, which I hide in the background. I also have to type the password to the ssh account I'm logging into on each tunnel.
Since all of them point to the same server/account, is there a better way to do this than to have 4 terminal windows open? As in combine them all into one script, type my password once, and let it be done?
Apple File Sharing
Code:
#!/bin/sh
sudo ssh server.server.com -l username -L 22:127.0.0.1:548
Plex Media Server
Code:
#!/bin/sh
dns-sd -R PMS _plexmediasvr._tcp . 32400 &
ssh -N -L 32400:localhost:32400 server.server.com -l username -p 22
General SOCKS Proxy
Code:
#!/bin/bash
ssh -D 9879 username@server.server.com
iTunes Home Sharing
Code:
#!/bin/sh
dns-sd -P "Home iTunes" _daap._tcp local 3689 localhost.local. \
127.0.0.1 "Arbitrary text record" &
PID=$!
ssh -C -N -L 3689:localhost:3689 server.server.com
kill $PID
I have 4 aliases to them in a folder and launch them each as needed, and each opens them in a terminal window, which I hide in the background. I also have to type the password to the ssh account I'm logging into on each tunnel.
Since all of them point to the same server/account, is there a better way to do this than to have 4 terminal windows open? As in combine them all into one script, type my password once, and let it be done?