Making It Easier To Ssh Into My Pi
I want to easily connect to my Raspberry Pi from my Windows machine, specifically from inside my preferred terminal, ConEmu. First we’ll need to set up some SSH Keys on the Pi(although if you’re comfortable keeping your password inside some configuration files, this is actually optional), set them up on the Windows box, and then configure ConEmu and your environment.
Setting up SSH Keys
On your Pi:
ssh-keygenand follow the prompts, accepting the defaults
- Save the key file to
/home/pi/.ssh/id_rsa(just press enter, as this is the default)
- Type in your passphrase (you can elect to keep this empty but it means that anyone who gets the private key will be able to log on to your machine. So consider if this is really what you want. For me, I don’t really care if people can log in to my Pi for now, so I’m ok with an empty passphrase
- Configure sshd
sudo vim /etc/ssh/sshd_configand ensure you have these values
RSAAuthentication yes PubkeyAuthentication yes PermitEmptyPasswords yes
- Copy the private key (
/home/pi/.ssh/id_rsa) to your Windows machine. You can just SSH in to the Pi using the username and password,cat` the file and copy them from the console. Save it to your home directory.
On your Windows Box
Starting with Windows 8 (I think?), Windows started shipping with a SSH client built in. Which means, as good as it was, there’s no need to download and install PuTTY anymore.
- Test the connection
ssh -i %HomeDrive%%HomePath%\id_rsa [email protected]
- You should now be logged in to your Pi
Integrating with ConEmu
For convenience I added the following alias to my cmd init file. It
allows me to just type
pi at the command line and be logged into
my Raspberry Pi immediately.
DOSKEY pi=ssh -i %HOME%\id_rsa [email protected]
Next I added a task in ConEmu so I can open a new tab directly into the Pi.
- Open the settings and go to
Setup/Tasks(or just press `Alt-Win-T)
- Press the
+button on the bottom left and fill in these values
- Name (first box):
ssh -i c:\users\joshq\id_rsa [email protected]
Save settings(or just hit the
- Try out the shortcut by pressing