Want to setup an FTP server on Raspberry Pi? It's pretty simple, so let's get started. This tutorial will assume that you're using a fresh install of Raspbian.

First things first, we need to install the vsftpd package.

sudo apt-get install vsftpd

By default vsftpd is configured for anonymous access with read-only permissions. We're going to change things so that it requires you to authenticate with a local user. Let's open the configuration file.

sudo nano /etc/vsftpd.conf

We want to change or uncomment the following values.

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
user_sub_token=$USER
local_root=/home/$USER/ftp

After that restart the vsftpd service. Now we need to create a couple folders in your local user's home folder. The ftp folder will be the root when you connect. The way vsftpd works, the root is not allowed to have write permissions on it, so we'll create a sub-folder inside the root called files which our local user will be allowed to write to. This is where you'd upload/download files from with an FTP client.

mkdir /home/<user>/ftp
mkdir /home/<user>/ftp/files
chmod a-w /home/<user>/ftp

Now you should be able to connect to your from any FTP client and start uploading/downloading files.


Comments

comments powered by Disqus