• Servers and Tools

What is SSH?

From the class:  SSH

If you've ever logged into a remote machine-- for instance, if you have an Amazon machine or a DigitalOcean machine-- then you've used something called SSH. It's short for Secure Shell, and it lets us login to a remote machine and run commands. We can even upload and download files using SSH. So if you're going to be deploying your own servers, or if you're going to be running your own servers and deploying software to them, you're going to need to know how to use SSH.

So in this class we're going to talk about what SSH is, and I'm going to show you how to use it. And even if you've already used it, I'm going to show you some tricks that you may not have known about before. I had actually used SSH for a couple of years without knowing some of the things that were possible, some tricks that make my life so much easier today. So let's start off this class by talking about what SSH is.

Now SSH by itself is just a protocol. That means it's a formal agreement between a client and a server for how they'll communicate. And so we'll need a piece of software that implements the protocol. And there's a couple different software programs, but the one that we'll use most often is called OpenSSH. This is the one that's going to be installed on your Mac, and it's also the one that's going to be installed on our Ubuntu machine by default. If you're running a PC, there's another program called PuTTY, and that implements at least the client portion of SSH. We're not sure about the server.

So what do these software programs do? Well, there's two parts. There is a client part-- and a client is usually something like your laptop or your PC-- and then there's a server part, which is usually some kind of server. It could also be another laptop, but the key idea here is that the client will connect to the server.

So we'll connect to the server over the network to a port. And normally this port on the server is 22, but it could be any port that we designate. And then once this connection is created, we can either run a remote shell and just keep it open and run shell commands; we could just run one shell command; we can upload files; we can download files. And so we can basically login and interact with the remote server, and we can do that securely. So the communication is encrypted between the client and the server.

So that's what SSH is. It's a protocol. And then we will install some piece of software that will implement that protocol, and it will allow us to log into a remote server from a client and run commands and download and upload files and that kind of thing. So there's a lot of cool tricks we can do with SSH, and I'm going to show you how all that works in the rest of this class.