Password-Free SSH For Windows without Putty

2 minute read

I’ve spent a few hours setting up password-free ssh access to Dreamhost’s websites a couple times now, and don’t want to waste this time again.

Dreamhost has instructions on how to do it with Windows and PuTTY, and how to do it on Mac, but I’m using Windows with Laragon‘s Terminal which has a few of the unix-style commands, and something about using PuTTY just seems barbaric. So this is how I do it without ever opening up PuTTY.

Enable SSH Access on a User

In Dreamhost’s admin, I need to enable SSH access for a user. Under “FTP & SSH Users”, I click “Manage Users”, expand the user with access to the server. If SSH if Off”, I click “Edit Access Settings” and enable their access. I may also need to reset their password because I’ll need it for a couple commands.

Setup SSH Keypair Locally

If I haven’t done it before, I need to generate a private and public keypair.

First, I check if I’ve already got such a keypair by checking if C:/users/{local-computer-username}/.ssh has files id_rsa and If they don’t exist, I use the terminal to run:

ssh-keygen -t rsa

I don’t bother putting a passphrase, although security experts will probably jump down my through for that.

SSH Into the SErver *with* a Password, One Last Time

Open up the generated C:/users/{local-computer-username}/.ssh/, and copy its contents.

Now ssh into the server from the command line. Normally I would do

ssh {username}

To make this simpler, in the file C:/users/{local-computer-username}/.ssh/config I add a couple lines, like this:

Host cmljnelson
	User {username}

Where {username} is my username on the remote server.

Then, when I restart my terminal, I can ssh in with just this

ssh cmljnelson

It asked for my password, which I got from the dreamhost web interface. I needed to reset the password because I’m not sure if I just missed when they emailed it to me or if they just never sent it. Oh well.

Add my Public Key to the Remote SErver’s AUthorized Keys

On the remote server, run the following commands (adapted from Dreamhost’s Windows guideline)

cd ~
mkdir .ssh
chmod 700 .ssh
vim .ssh/authorized_keys

Paste the contents from your local C:/users/{local-computer-username}/.ssh/ into

chmod 600 ~/.ssh/authorized_keys

Password-Free SSH Login

Next time ssh into cmljnelson, I don’t need to use a password 😀

Leave a Reply