Sunday, May 27, 2007

How to turn your computer into an SSH server

After being consistently pestered after converting my Desktop into an SSH server, I've decided to put up a guide on how to turn your computer into an SSH server. The first step is to get openSSH for your particular computer. Most distributions have a way of installing: For Ubuntu, it's "sudo apt-get install openssh-server", for others, I don't know. Look in your documentation. If your distribution does NOT have a way to install openSSH (I don't believe you), the source can be found here.

Officially, this is the end. Congratulations, you now have an ssh server. How do you use it? Who cares, you have an ssh server. However, having a server and not knowing how to use it is kinda useless. So, here's a brief synopsis of how to connect. There are a lot of different ways to connect to your computer via ssh. One is through your local network (typically 192.168.x.y) x and y depend on your network. Another way is though your ip address (you can find that out at ipchicken). However, for most home users, your ip changes every time you log on to the internet, so that's not very practical. A way you can circumvent this is by using a Dynamic DNS service.

Dynamic DNS basically gives you a host which keeps track of your ip address instead of you having to. Some popular ones are DynDNS, no-ip, zoneedit, and easy DNS. I personally use no-ip because it sounded cooler, but be creative. If something else works for you, leave a comment! So yeah, basically all you have to do is sign up. After that, you'll get a chance to download a program. Do it! You should get the tar.gz file. After that, unzip it, and do the configure, make, install cycle (or, whatever you do to install from source, or follow this guide). If you don't want to install from source, you can get the no-ip program from the ubuntu respository. However, the direct program calls itself noip2, while the ubuntu one calls itself noip, so make that distinction. After you install it, log onto the no-ip web site. In the left-hand column, you'll see Hosts/Redirects, then add. Click add. For Hostname, put whatever you want your hostname to be called (mine is cactaur). Pick a server, particularly one you can remember easily (I chose After that, leave the rest as defaults and press "Create Host".

Now go to a terminal, and type in "sudo noip2 -C". You'll be prompted for an e-mail, put the one you registered on no-ip with. Same with the password. This sets up noip to get your ip address, and all other network information. After that, type "sudo noip2" to set up the daemon. Now (ideally), you can ssh into your machine by putting "youraccountname" (for me, it would be Now, you want to run no-ip every time your machine boots, first type "whereis noip2". This tells you where the binary is located (typically /usr/local/bin/noip2). Next, use that location in this command "echo '/usr/local/bin/noip2' >> /etc/rc.local" Now, it should (ideally) work. But if it doesn't, don't act surprised, I probably can't even troubleshoot most ssh problems.

No comments: