Archive

Archive for March, 2012

Getting past school port blockers.

March 1, 2012 Leave a comment

I was stuck in a class on campus and wanted to get on IRC (yes, it was a boring class). My school blocks port 7000. This is normal because IRC is used by botnets for communication. So, I did what I normally do in these situations. I attempted to ssh to a server at work and setup port forwarding.

ssh: connect to host myhost port 22: No route to host

This ticked me off. Who blocks port 22?! Anyways, before getting on IRC was not really important. But now this had gotten personal. God knows I will need to ssh from school at some point for work. I needed to find a way to fix this.

This is where using EC2 is awesome. The Amazon Linux and Ubuntu AMIs (server images) allow you to pass a script to run on first boot. All you need to do is put a shebang at the top of the user data that is given to amazon when you start the instance.


#!/bin/bash
echo >> /etc/ssh/sshd_config
echo "Port 443" >> /etc/ssh/sshd_config

That was all it needed. The first echo is probably not necessary, but it ensured the file ended with a newline. After a reboot (protip: /etc/init.d/sshd restart), I was able to use ssh.

Thank god for the universal firewall bypass ports: 80 and 443!

Categories: Uncategorized