In this tutorial I'll show you how to use SSH and SFTP to control your new Raspberry Pi and access files.
Note: This tutrial assumes you have installed Raspian to an SD and connected your Raspberry Pi to your home network. We have an article coming soon for these steps.
You can connect a Raspberry Pi to a monitor or TV, but for most projects it's more practical to run them headless, with no monitor, keyboard or mouse. All of mine run headless in the background. I access and control them via SSH and SFTP.
There are several ways to use SSH and SFTP. You can use them from a Linux terminal or a Windows Command Prompt, but in this tutorial we'll be using an SSH program.
Many people use the open-source Putty program, but I've been using Bitvise for many years, and it's what I'm used to.
I don't generally recommend proprietary software, but Bitvise is a solid program for maintaining multiple Raspbery Pi computers.
You can see from the image above I have instant access to all six of my Raspberry Pi units from my Windows taskbar.
It is not just for Raspberry Pi, you can connect to any Linux computer with Bitvise. I'm using it now to connect to my server in the US from Australia to write this article.
Click on the Bitvise SSH Client Installer link at the top of that page.
Once the download finishes, run the .exe to install the program.
When Bitvise starts it will open the Login window. This prompts for the host (the name of the Raspberry Pi) and your user name on the Pi.
If this is the first time you've powered up your Pi, you'll need to log in with the default Raspberry Pi user and pass. Enter raspberrypi as the host, and pi as the username.
If you've already changed the host name or configured another user account on the Pi, use those details instead.
Underneath the username field you can (optionally) choose an initial authentication method, and enter your password. Otherwise, leave the initial method as none and you'll be prompted for your Raspberry Pi password when you log on.
If you are logging in for the first time as the pi user, the password will be raspberry. We'll create a new user and password in our next article, and delete the pi user.
When you click Login, Bitvise will open two new windows, a Linux terminal, and an SFTP window.
The terminal window allows you to run just about any command you could if you were using the Pi directly.
You can install updates, install software, reboot or shut down the Pi, etc.
The SFTP window lets you easily transfer files and folders between your Raspberry Pi and your Windows computer.
You can also modify files on the Raspberry Pi without downloading them to your computer.
This is a lot simpler than setting up network shares with Samba, and in most cases it works just as well.
There are two columns in the SFTP window.The left column is your computer, the right column is the Raspberry Pi.
By defualt these will open to the Desktop on your computer, and your home folder on the Pi. I've change this to a dedicated folder on my computer, and the home-automation folder on my Pi.
To download a file to your computer, right-click the file in the right column and click Download.
The file will now also appear in the left column.
To upload a file from your computer to the Pi, right-click the file in the left column and click Upload. That file will be copied to the right column.
Saving your profile
Let's configure and save your profile for one-click access to your Pi.
You can close the terminal and SFTP windows, but leave the original login window open.
Click the SFTP tab at the top of the window.
Under Local and Upload Settings you can enter the full path to your desired starting folder on your Windows computer. I use a folder in Dropbox so the profile will share between all of my other computers.
Alternatively, you can select the Start in last directory check-box to start in whichever folder you were in during the last session.
Under Remote and Download Settings you can specify a starting folder on the Raspberry Pi. Once again you can instead choose to start in the last directory.
Click on the Options tab to choose which windows open when you start the program.
You can un-check Open Terminal if you only wish to open an SFTP window on startup, or uncheck Open SFTP if you only want a terminal to open.
Under Reconnection you can choose whether the program automatically reconnects if a session is temporarily interrupted. I leave this checked, it's helpful if you have a sketchy network connection at either end.
In the Terminal tab you can click Default Colors to set colors for the terminal window.
This really helps when you are connecting to multiple Raspberry Pi terminals, because you can use different colors for each, and see at a glance which Raspberry Pi you are using.
In this tab you can also set the initial width and height of the terminal, and choose how many lines of history to show.
That's about it for our SSH and SFTP tutorial. You can see there are many other options, but I only use the features we've covered today.
Click Save Profile in the left column of the login window and save your profile. So you can easily open your profiles later, right-click the Bitvise icon in your Windows taskbar and click Pin to Taskbar. You can then logout and exit Bitvise.
To reopen Bitvise. click the taskbar icon and your previous profile will load. If you have multiple profiles you can right-click the taskbar icon to choose from a list of your profiles.
In our next Raspberry Pi article we'll change the host name for your Pi, create your new username and remove the default pi user.