Working from home and not having it suck balls
10/02/2010This is my typical desktop (well one of them) when I’m doing work at home. I really like kate as my code editor. It does pretty much everything I need and I like the built in terminal and the extensions & scripts you can use with it. But I’m not here to proclaim another holy war begun, instead I want to outline some of the tools I’m using in the background to avoid ripping out my hair and generally being more productive as a *nix based developer. For the most part, half of this shit works fine on a mac too out of the box. Something my good friend ServeBlunted will happily remind me of.
I say “some” tools. I really only mean one. SSH. Thats it. As a linux user both at home & at work I spend a lot of my time in X. It can be handy to have a GUI app I’ve got on my work machine running at home if I’m working so when I ssh into work I always tunnel through X. You can do this by just adding “-X” as an option.
ssh -X jaymz@work.company.com
X tunelling is handy, it sure beats trying to work via the likes of a VNC session, but the best thing about SSH for me is sshfs. Using that you can create a folder on your local machine and then mount a remote folder over SSH to it. Then you fire up your editor and work away. If you’re like “yeah, whatever, I can edit my files via FTP in my editor and it syncs” then shut up, go give it a go and get back to me. It’s a lot more flexible, you almost forget its a remote filesystem. To mount a remote folder as if it’s sitting on your home machine its typically done like this:
sshfs /tmp/local jaymz@work.company.com:/var/www/dev-code
Where you’d replace the names of the folders with whatever works for you. This lets me mount my code and work on it from within any application as if it was totally local. In the above screenshot I’m actually working on code on my work computer a few miles away. I’ve also ssh’d in via the built in terminal so for all intents and purposes its just like I’m working at the office. The final thing that ssh makes easy for me is port tunneling. I don’t use this as much but it can be handy. The basic command is:
ssh -L 8080:10.10.91.1:445 jaymz@bowser.worknetwork.com
The red number is the local port. This is what you are going to be using in any config or browser screen on your workstation. The green IP address is the machine you’re actually interested in connecting to and finally the orange port is the port in question that you want to connect to. Then you give it your login credentials as you would normally. This is really useful for when you have dev servers that are locked down to only local network connections (like a mysql setup to only connect via localhost for example). The above is what I would use if I wanted to connect to the firewall’s web interface. This is only accesible to my workstation in the office but using tunnelling I can bring it up from home without tunnelling X and loading firefox (which would also work
).
There are a whole lot of ways to set tunnels up with SSH, the -L means you are wanting the connection to go from your local machine to the SSH box and then to the destination. You can also use -R which goes from the SSH box to your local machine and then to the destination. You might need to read that a few times
There’s a whole lot more info on tunneling here.
