As a person who manages about 10 web servers on a daily basis (yes, that’s the overworked poor me), SSH/SCP has been invaluable in having me get things done faster while keeping things secure.
For those of you who don’t know, SSH is basically a secure shell for linux systems (my web servers run linux) so you can connect to it remotely and get things done. Of course, you will need a dedicated server of some sort because most shared web hosting companies don’t allow for SSH connections. (or VPS would work too such as MediaTemple or VPS.net, both which I use on my smaller-scale sites, read my web hosting review here for that)
For one, you can transfer files much faster between two computers using scp, which is a secure copying command you can use under SSH. Also, you can download files from websites at lightening speeds using wget, which is a command for downloading any web page or file on the interwebs.
These two tools help me save a ton of time doing things like upgrading my WordPress or installing new WordPress plug-ins.
For example, I can upgrade my WordPress to a new version in about 15 seconds literally.
How to SSH?
SSH on Windows
For windows, you will need to download an SSH client which allows you to connect to your web server via SSH. You will also need your server SSH login and password, something your hosting provider should give you.
Once you have your SSH client software running, you can set your hostname to your domain name where the web server lies or use its IP address plus the login/password.
SSH Client on Linux
For those of you on linux computers, you are in luck because SSH is usually included as a basic package. For SSH command line, you can do a simple command like “ssh myserver.com” to connect to another server.
Now this can get annoying if you have to type your password everytime you connect. Therefore, you can setup SSH authentication keys on your linux computer, which will allow you to connect without a password.
I won’t get into that in this post but let me point to you in the right direction for great sites to learn more about SSH in general and setting up the authentication.
- SSH Tutorial for Linux
- SSH Basics
- How to Setup SSH Keys
- OpenSSH Public Key Authentication HOWTO
- SSH and SCP HOWTO
SSH Client on Mac
Macs should be almost identical as Linux as there’s a Unix terminal, you can read up on SSH in Mac OS X here if above HOWTOs don’t work for you.
SSH Client on iPhone/Android
For iPhones, there’s iSSH, pTerm, TouchTerm, or SSH as SSH Client apps. You can read up on the round-up review for each of those here.
For Android-based phones such as the Nexus One, try ConnectBot.
Why do you need an SSH client on your smartphone? Because you could be doing things like rebooting your web server or even backing up all your data while you in the bus, train, whatever. How cool is that?
SCP is a linux command you can use under SSH secure shell to transfer files between servers.
For example let’s say you have a Mac or linux computer at home, you can use SSH to transfer files to your Mac/linux more faster and secure than typical FTP. FTP programs can get a bit hairy when you start transferring large files over like 15 GB. SCP is great because it’s a lot more stable than FTP plus it’s simply way faster.
Plus, you can write up a simple bash script to automate the backing up of your web server using scp.
Basically, you can do something like this:
scp * email@example.com:/mybackups/.
This would transfer all files in current directory to your homeserver at myhomeserver.com under the /mybackups directory.
The beauty of scp is that it works like a regular cp command and you can do the opposite too.
scp firstname.lastname@example.org:/mybackups/* .
This would transfer all your files in your homeserver at myhomeserver.com to the current directory of the web server.
Remember you can also use IP address instead of a domain name. Personally, I use a dynamic DNS setup on my linux server so I don’t have to know my own IP address. (Read up on how to setup free dynamic DNS for your Ubuntu here, all other linux distros should be similar)
Also, remember to change “root” to your username.
There’s a bunch of more great stuff you can learn about scp, here’s some links to more SCP HOWTO tutorials:
One more thing, sometimes on slow VPS sites, your scp transfer can come to a halt during transfer (although it doesn’t happen often). For those times, you can actually use a neat little hack to resume your file transfer using alias and rsync.
Extra – SSH Tunneling
SSH tunneling is a super powerful concept that allows you to connect two servers as if they were connected locally. You can use SSH tunneling to have your web server pull MySQL database from your home server for instance (although that’d be slow). It’s simply a great skill to learn if you are a webmaster.
Or even share internet access between linux/Mac computers if you want.
Well, I just covered two of the most important things you should know as a webmaster who manages SSH-enabled web servers. And if you are not on SSH-enabled servers, you should be. It’s simply faster, more secure, and what the professional webmasters use. And yes, I am claiming myself a pro now. 🙂
Hopefully these tips will help you become better webmaster and don’t forget to re-tweet my post plz!