Best way to make a script for SSH?
There are quite a few files in my university (like past docs, etc.) that I need to find on the uni network to access them. I ssh, using port forwarding, to the network and configure my browser (Firefox) to go through that port. I know it would be easy to write something in most languages that will go into a command in the terminal, but what language / method can I use to make this happen? I expect some scripting language might, but I don't really know anything about them, but I would be willing to learn it to get a little bit of it.
I am using cygwin terminal on Windows 7 in case that matters.
To clear up my question: What language would be the best way to get the above effect? Not necessarily the best, simple and relatively easy to learn. I used the word best, so I guess I put a subjective tag.
EDIT: Just in case, anyway, I want to show my solution. I ended up using a batch file because several things made bash more complex. Anyway, to SSH on the network and open a new firefox window with a modified proxy, I just need to open this batch file and enter my password.
cd C: / cygwin / bin ssh -fND 9001 username@your.website.here cd "C: / Program Files / Mozilla Firefox" firefox -no-remote -P SSH_profile
Save as .bat
To do this, you need to set up a profile named SSH_profile (or whatever) and set the connection parameters to go over port 9001. Open the script with the ssh command in / cygwin / bin and enter the information. You enter your password and then it goes to your firefox directory, uses those arguments that open a separate profile with changed connection parameters (this means you can view inaccessible files in one window and everything you don't want to use in your uni -networks in the other. Just close the windows when you're done.
Quite a specific case, but I decided to share my answer in the hopes of helping someone, someday.
a source to share
Since you are using cygwin, write a bash shell script. ... If you don't want to rely on bash, powershell will be what you want, although you can probably get it to work with a batch file .
This is exactly what the shell scripts say.
Edit
You can change firefox options on the command line by passing a flag -override
. This will give you special settings for the called process.
a source to share