Linux Fix #2: SSH

Have you ever heard of astral projection? SSH is somewhat similar.

You send your keystrokes, to wit, intention and control, to a user session on another computer. This happens over L4 in the OSI IP stack, and can work over most home and internet-connected devices, so long as you can set it up on both ends.

The syntax is pretty simple, and somewhat reminiscent of email:

ssh [username]@[host]

Through this, you can access computers in another room in your building, or, depending on how you choose to route it, another website entirely. This is the way I update the underlying software for the server that this blog is stored on.

Of course, it takes a bit of setup. SSH comes preinstalled on some operating systems, but not all of them. Your first step will be to create a keypair:

ssh-keygen -t ed25519

You can keep most of the prompts blank or default. This should deposit a couple of newly-minted files in your ~/.ssh directory. Once this is complete, you should be able to use ssh-copy-id username@remote_server to any networked server you have password access to, in order to set up spanking new passwordless access. It's fun, I assure you.

A little bit about how the magic works: SSH private & public keys are created at the same time and have a mathy relationship with one another. Your public key can, in turm, authenticate you into any resource you want, and can be shared without revealing data in the private key. GitHub uses this method to determine your identity.

As an aside, you can use a similar structure for SFTP & SCP file transfer and copy protocols. You can find more information on those in many other places.

I first encountered it while operating on my first EC2 instance, way back when Amazon Web Services was only a few years old. But it's almost as old as I am, having been designed in 1995. What most of us use today, OpenSSH, was built in 1999. Many programming languages have modules that allow you to ssh directly in the code, such as Python's Paramiko. Go forth and check it out.