Server week : The essential SSH Server.

Mar 18

This week in “Server week” we are going to set up a variety of servers that allow you to do a variety of things. One of the most basic and versatile server you can set up must be the SSH Server. Long time fans probably know that the SSH server is the base ingredient for a lot of fun stuff you can do. For example.

  • Transfer files over the internet.
  • Work with command line applications from a remote computer.
  • Tunnel your browser traffic through your own server to stop nosy network admins.
  • Connect to your home network with a VPN connection.

These are just a couple of things you can do, but before you can do that, you will need the basic ingredient : Let’s set up an SSH Server.

MOTD_TAIL

Required ingredients.

  • Debian based Linux distribution : ( you can do it with a redhat based one too, but we use a debian based one for the tutorial)
  • Static ip for your Linux distribution.
  • Connection to the internet.
  • If you don’t have a static IP : A dynamic DNS service like opendns or Dyndns.
  • An open port on your router forwarded to your linux machine.

Let’s get cooking.

  • Open up a terminal on your linux machine and type : sudo apt-get install openssh-server
  • After the server is installed, connect to it from a remote machine using a terminal application like Putty (for Windows) Secure Shell (for the Chromebooks) or from the terminal on other Mac and Linux machines.
  • Connect to your Linux server with the command : ssh yourusername@theipofyourserver

And starting out that is ALL you need to do. If you want to do this from the internet you need to forward the correct port (The standard port is Port 22) from your router to your linux machine so you can make it accessible from the internet.

Lets make it pretty.

Lets make it secure.

  • SSH servers run standard on port 22, so a lot of scriptkiddies will go around the internet and “knock” on your port 22 to see if there is a server there. We are going to “obscure” the location of your SSH server a little by changing the default portnumber (Remember you also need to adjust this on your server) Follow THIS tutorial to get you started.
  • Next time you connect remember to connect with ssh -p portnumberyouchose yourusername@theipofyourserver
  • If you want to get rid of entering your password when you connect you can log in using secure SSH keys. Its a little bit on the advanced geeky side but it DOES keep your machine extremely secure : Only a machine with a unique digital fingerprint can connect using this method : Here is a good tutorial.

Lets start using it.

The SSH server offers you a variety of functionalities we talked about in previous blogposts. We will line up the best uses for SSH here.

These are just a couple of examples of what you can do over this very powerful little SSH connection. Remember always to use strong passwords and keep your server up to date.  Have fun ! 

Related Posts

Point the Way Home: DDNS with Linode

Aug 02

Guest Blogger: Keith Murray

Earlier this year I switched my web hosting from my long-time account at DreamHost to a fancy new VPS at Linode. I really did enjoy my time with DreamHost, but what I wanted out of my hosting provider had changed somewhat. I was looking for full control of a machine in the cloud. Although DreamHost does offer a VPS option, the pricing options just didn’t compare with what Linode was offering.

I also took the opportunity to move my domain registrations over to Hover, but more on that another time.

With my Linode account managing the DNS for my domains I was able to point a a single subdomain back at the IP of my home network, effectively giving me a nice publicly accessible domain from within my network. This worked well until my ISP changed the IP address I had. Admittedly this doesn’t happen often, but it always seems to occur when I actually need to make use of this remote connection, and with no knowledge of my new public DHCP address it’s pretty useless.

Enter DDNS.

With some modifications to a script I found on GitHub I was able to quckly set up job to check my public IP address and update the DNS records at Linode using the Linode API. I hacked apart the original script and put together my own DDNS update script, suitable for automating.

By scheduling the script to run using a simple crontab entry I can rest assured that every night, while I’m asleep, my server will be connecting to Linode to point the way home.


Keith Murray is a software architect and developer who blogs about technology and science at kdmurray.net. He can also be found on twitter as kdmurray.

Related Posts

Basic Ninja moves for OSX command line users.

May 14

When working with the silver bezels of OSX, we sometimes forget that underneath this polished operating system (that seems to favor the non-power user more and more) sits a powerful command line. We found a nice instructional video that shows you some of the neat “Linux Style” command line ninja moves that can help you when you are using the CLI. So come on “command line kid” … Wax on … Wax off ! 

What are YOUR favorite OSX command line shortcuts  ? Tell us in the comments section.

Related Posts

Get the audio from a Youtube video with one command.

May 02

By now most (if not all of you) have dabbled a little bit with Linux. Although it might look geeky and complicated at first glance, once you dip your toes into the great lake of open source it becomes a very refreshing computing experience. How do I mean ? Well : I challenge you to the following : Take a Windows Machine OR a Mac and, within 2 minutes FIND and INSTALL a free application that allows you to download a Youtube video and extract the audio to MP3. If you started off your search in Google (or in the Mac App store for that matter) you are starting to realize it is not that easy. There is a ton of ‘supposed’ freeware out there that, after installing it gives you either an app that does not completely work (unless you pay for it) or is just too complicated.  Do you (as a true slider) have a Linux machine handy ? (perhaps a virtual machine or a server ) Then lets fire up the command line and give you a one line command to make that technology work for you.

Introducing “Youtube-dl”

Youtube-dl is a command line application that lets you download Youtube video’s and if you want to, extracts the audio from said video’s. The command is simple. On Ubuntu you can install it by hitting : 

sudo apt-get install youtube-dl

After the installation is complete you need to update the app to the latest version. Also .. a couple of  one liners.

sudo youtube-dl -U

You will get an error that you need to update via the GIT repositories once more. Easy peasy (copy and paste people)

sudo wget http://youtube-dl.org/downloads/2013.05.01/youtube-dl -O /usr/bin/youtube-dl
sudo chmod a+x /usr/bin/youtube-dl

Lets start Downloading.

Now surf to the Youtube video of your choice and copy the url to your clipboard.

Go back to the terminal and type : 

youtube-dl <paste your url here>

Presto ! You will have the youtube video all for you ! What if you want the audio ? 

youtube-dl --extract-audio <paste your url here>

Cross platform compatibility

Youtube-dl is also compatible with Macs and there is an .exe for our Windows friends. But because the command line is so easy I just leave a terminal open to my linux machine (on ANY machine i’m working on) and just copy and paste whatever cat video I would like to keep for prosperity.  And youtube-dl does also support tons of other video sites like Vimeo and more ! 

Links : the Youtube-DL page.  and their howto for Windows and OSX users.

Related Posts

The last item on your current todo list : Install todo.txt

Feb 20

Yes, because, quite frankly, that will be the end of your current todo application. Wether or not you are using a modern day todo list like Wunderlist on your smartphone or you are writing down your items on a running Cheeta (It takes a while but it’s a great workout  ) you might just switch to todo.txt after you read this post.

Why ? Because todo.txt is a slider friendly way of keeping track of things. They offer an an Android version (1,47 $) and an Ios version (1.99) that will give you a nice mobile application, but the kicker of this service is, they also offer a command line interface ! Straight from your favorite command line (if you are using Linux of course) you can manage and update your todo list from anywhere. The command line script can be downloaded for free. 

 

This “compatiblity” is because todo.txt stores your todo list in a textfile, a human readable textfile that can also be opened using just any text editor, AND you can actually read and understand what it says.

Todo.txt is pretty brilliant in its simplicity. I love adding another command line app to our list, but a little disappointed these guys don’t have a free app in the stores. (Like for example Wunderlist). Todo.txt also lacks a web interface (bit of a bummer there) but overall offers their users great value for money. You might want to try it out : Its explained in this video here 

Links : todo.txt

How do YOU keep track of your todo’s ? Tell us in the comments section.

Related Posts