Disclaimer: I have no experience with any ssh software under windows.
Important preamble:
You really should check back with your school's IT department, whether they like your idea. If you just do it right away, and they find out, you are in serious trouble.
I know, school networks are oftentimes very amateurly monitored, so your chances may be quite good. And I know, a properly secured tunnel is nothing to be afraid from.
But one should always adhere to company/network policies. And if there's no policy explicitly forbidding something, you might want to think about what you are expected to do on this network. In schools, you are usually expected to browse the web or send emails. If you do anything beyond this, you might want to contact the IT department.
If you got your OK, proceed:
Step 1:
For this to work, you need to configure public key authentication on your FreeSSHd server. I'm sorry, I can't help you with that. And you need to create you public/private keys on your Pi. Depending, whether you want root or your current user to be the one to establish the connection, issue
ssh-keygen
or sudo ssh-keygen
(when asked for a password, just hit enter)
This will create a *.pub-file in either /root/.ssh/
or in your ~/.ssh/
. Copy this file to your home machine. Now you need to google the FreeSSHd specifics. You may have something like an authorized_keys
file. Copy the contents of the *.pub into this file.
Now, you should be able to ssh
home from your Pi, without typing in a password.
Step 2:
On the Pi, you can open a reverse ssh tunnel with a command like this:
ssh -f -N -R 14000:localhost:22 [email protected]
22 is the local port (where sshd on the Pi is listening). 14000 is the remote port number you chose (also see below). You can configure this line to be automatically executed on startup (make sure, network is available, before this command is issured - or you could just do some sleep
). Also, it's worth noting, that autossh
may be a good substitute for ssh
in this case (see here).
Step 3:
Back home on your machine, you connect to localhost, with the port you previously provided:
ssh -p 14000 piuser@localhost
As I said, I only have Linux experience. If FreeSSHd works as I am used to, you should just be able to open a similar connection with PuTTY (target is localhost/127.0.0.1, port is 14000).
Other idea:
An other method I really like is to host your own hidden service on your Pi. This way, you have your own TOR-address and a firewall/NAT becomes kind of transparent. Therefore you need no reverse ssh tunnel, as you can connect directly (via TOR). I use this for a RasPi server, which is out in the field, otherwise inaccessible behind a UMTS-Stick.
However, I do not recommend to host a hidden service in school. You could have a chat with your IT guys about this, but don't expect them to be happy. I added this, as it can be a valuable trick in some circumstances, and it's good to have heard about it. But I have to reiterate: Don't try this at school.