How to set up SSH and SFTP on a Raspberry Pi

If you want to access your Raspberry Pi from any computer on your network you’ll want to enable SSH. SSH stands for Secure Shell and it’s a secure, text-based way to remotely login to another machine on a network. For Raspberry Pi, it is essential if you want to run a ‘headless’ setup. That is, being able to access it via network connections without having to physically connect a keyboard and monitor to it.

In this tutorial we will also set up SFTP. SFTP stands for SSH File Transfer Protocol. It is a secure way of remotely transferring files between two computers. It is more preferred than standard FTP because it uses a secure connection where all of your data is encrypted.

By setting up SSH and SFTP you’ll be set up to access and transfer files between your Raspberry Pi remotely.

Requirements

Instructions

1. Install Raspbian OS

First, you must install the Raspbian OS on your Raspberry Pi. Check out the official guide here .

2. Set a static IP address

You’ll want to set a static IP address on your Raspberry Pi to ensure you will always be able to connect to it at the same IP address. To do this, use my guide here .

3. Enable SSH access

Open up a terminal and type the following command

Your terminal window will look something like this.

Navigate to ‘Interfacing Options’ and hit ENTER. You will now see a lot of options that you can enable/disable. We want to enable ‘SSH’ so use your arrow keys to navigate to the SSH option and hit ENTER to enable SSH on your Raspberry Pi.

Congratulations, you have successfully enabled SSH on you Raspberry Pi! Now you can remotely login to run commands, transfer files over SFTP, and run your Raspberry Pi headless (without a monitor).

How to connect to your Raspberry Pi via SSH

Windows

Download Putty  to log in to your Raspberry Pi via SSH.

Choose either the 32-bit or 64-bit version, download, install, and run it.

Input your Raspberry Pi’s static IP address, use port 22, and click ‘open’

Enter your login credentials. If you have haven’t changed these, they are:

SSH Raspberry Pi Windows

Now you’re ready to issue commands to your Raspberry Pi.

Mac OS X / Linux

In Mac or Linux, all you do is open up a terminal window and type:

Changing username to your pi’s username of course. It will prompt you for your password. Once that’s entered you’re ready to issue commands to your Raspberry Pi.

ssh raspberry pi mac

How to connect to your Raspberry Pi via SFTP

Windows

Use either WinSCP or FileZilla . I use WinSCP.

Make sure ‘File Protocol’ is set to SFTP. Enter your login details and click ‘Login’.

sftp raspberry pi windows

Mac OS X / Linux

For Mac OS X or Linux I use FileZilla as it supports SFTP.

Enter your login details either via a new ‘Site Manager’ entry. It should similar to this.

Click connect and you’re able to transfer files to your Raspberry Pi now!

sftp raspberry pi filezilla

(Visited 522 times, 3 visits today)