How to Setup a Raspberry Pi SFTP Server
SFTP stands for SSH File Transfer Protocol and is a secure way of remotely transferring files between 2 computers. It is a more preferred way of transferring files over the standard FTP protocol because it uses a secure connection meaning all your data is encrypted. FTP is an insecure way of transferring files and can easily be monitored over your network to intercept and see what files are being transferred, like secure bank information.
SFTP runs on port 22, the same standard port as a regular SSH connection, and FTP runs on port 21. It is advised that you change your SSH Port to improve security on your network. You can also port forward port 22 on your router to allow access to your Raspberry Pi server over SFTP from anywhere outside your network, but make sure you change your SSH port if you will be doing this to reduce the amount of attempted hacks on your Raspberry Pi SFTP server.
Today I will be showing you how to setup a Raspberry Pi SFTP server so that you can easily access files on your Raspberry Pi. This can be very useful if you are using your Raspberry Pi as a Network Attached Storage device or simply as a web server. Transferring files over SFTP will allow you to quickly download or upload multiple files with no issues and make changes to your web server on the go.
To setup our Raspberry Pi as a SFTP Server
You will need the following:
- Raspberry Pi
- 8GB Micro SD Card (Bigger SD card if you plan on saving the video to the SD card)
- 2.5A Power Supply
Setting up your Raspberry Pi SFTP is very easy and all we need to do is basically enable the SSH server on our Raspberry Pi because our SFTP server will be transferring files over SSH. Open a new terminal window on Raspbian desktop and type the following command to open the Raspberry Pi config tool.
Your terminal windows should turn a grey / blue color and you will get a few options. Navigate to the “Interfacing Options” and hit enter.
You will now get a bunch of interface options that we can enable and disable. The option we want to enable is “SSH” so scroll down to the SSH option and hit enter to enable SSH on your Raspberry Pi.
You will get a confirmation windows asking you if you are sure you want to enable SSH, select Yes
Congratulations, you have successfully enable SSH on your Raspberry Pi and you can now transfer files over SFTP as well as connect to your Raspberry Pi over SSH to run commands on your system. This will come in handy if you are running your Pi headless (Without a monitor) since you will not need to constantly connect a keyboard and mouse to your Raspberry Pi if you need to run some commands.
How to Connect to your Raspberry Pi SFTP Server
Now that you enabled your SFTP server you will need to connect to it if you want to transfer files. You will need some sort of FTP client to connect to your Raspberry Pi. I recommend FileZilla, it’s a great free FTP client that runs on Windows, Mac and Linux and is very lightweight. Go ahead and download the FileZilla client.
Once you have downloaded and installed FileZilla, open it up and type in your Raspberry Pi’s IP Address and Port 22 to connect to your Raspberry Pi over SFTP. That’s it. You will not be able to transfer files over SFTP on your Raspberry Pi.