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.
- 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.
- Want to have a unique login screen when you connect ? create a cool ASCII banner using THIS tutorial.
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.
- Make a VPN connection to your home network using SSHUTTLE.
- Turn your server into a proxy server and tunnel all browser traffic though your home server. (here is the pdf howto)
- Keep an eye on what your server is doing.
- Run a remote supergeeky wordprocessor.
- Run remote graphical applications.
- Have a blast controlling your server from the command line.
- Run command line apps.
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 !