TechKnowSurge
CompTIA Server+ 2.3 CompTIA Network+ 1.4 Cisco CCNA 4.9 CompTIA A+ Core 2 1.11
VideoNetworkFree

DEMO: Setting up FTP Server on Pi

A practical walkthrough of installing and configuring a vsftpd FTP server on a Raspberry Pi, including package installation, configuration file editing, directory setup, and service management.

Complete this video to capture a CTF flag worth 1 point.

About this video

Setting up a vsftpd FTP server on a Raspberry Pi begins with ensuring the system is fully updated using apt-get, followed by installing the vsftpd package with elevated privileges. Once installed, the vsftpd.conf configuration file is opened in the nano text editor, where several key directives are enabled: anonymous access is disabled, local user login and write access are turned on, the local umask is set, and the chroot_local_user directive is uncommented to confine users to their home directories. A custom local_root path and userlist token are appended at the end of the configuration file to define where each authenticated user will land upon connecting. With the configuration saved, the appropriate directory structure is built inside the user's home directory, creating an FTP folder and a nested files subdirectory. Permissions on the FTP directory are adjusted using chmod to align with vsftpd's security requirements, and a simple text file is placed in the files folder to serve as a download target for testing. Because the configuration file was modified, the vsftpd service must be restarted using the systemctl or service command before any changes take effect. This setup provides a working FTP environment suitable for observing and analyzing FTP traffic in a controlled lab context.

What you'll learn

What's covered

Setting Up FTP Server

Aligned to

CompTIA Server+
2.3 Given a scenario, configure and maintain server functions and features.
CompTIA Network+
1.4 Explain common networking ports, protocols, services, and traffic types.
Cisco CCNA
4.9 Describe the capabilities and functions of TFTP/FTP in the network.
CompTIA A+ Core 2
1.11 Identify common features and tools of the Linux client/desktop OS.

Key terms

File Transfer Protocol
FTP
A standard network protocol used to transfer files between a client and a server over a TCP network.
Server
A computer or program that provides services or resources to other devices, known as clients, over a network.
Port
A logical endpoint for communication in a network, identified by a number that specifies a particular service or application.
vsftpd
A secure, stable FTP server daemon for Linux systems, commonly used to host FTP services on Unix-based operating systems.
File Permissions
Settings on a Linux file or directory that control which users can read, write, or execute it.
Configuration File
A text file containing settings and parameters that control the behavior of a system or application, such as the Raspberry Pi boot configuration.

Transcript

We're going to set up an FTP server on our demo Pi, so that way we can connect to it and see what traffic looks like.

Installing the FTP service

The first thing that I'm going to need to do is install the FTP services. So what I'm going to do is pull up a terminal window on the demo Pi machine. I'm on the demo Pi. I'll make it a little bit larger so we can see this.

And then within here, I'm going to type in sudo, because I need elevated permissions for this, and apt-get, and we are just going to update all of the packages on this machine to make sure that everything is up to date. Once everything's up to date, I'm going to elevate the permissions once again and use our apt-get, and this time I want to install, and I'm going to install vsftpd. So I'll install this. It takes about a minute for it to install.

Editing the configuration file

Once it's installed, we can jump into our configuration file and edit some of the configurations. So I'm going to use my elevated permissions once again, and I'm going to use nano to edit the /etc/vsftpd.conf file. There's a few items that we'll uncomment and a couple of changes that we're going to make in this.

The first one is this anonymous_enable, no, which is already uncommented, so I don't need to worry about that. local_enable, yes — that's uncommented, I don't need to worry about that. write_enable, yes: I want them to be able to write, so we're going to uncomment that. And then scroll down to the local_umask. This is setting up some permissions, and I'm going to uncomment that. And then scroll down to find chroot_local_user, yes. So I'm going to scroll down till I find that and delete the comment off of this one.

And the last thing that I'm going to do is scroll to the end of the document and add this user_sub_token=$USER and local_root=/home/$USER/ftp. I'm going to exit out of this document now and save it.

Creating the directory

So the next thing that I'm going to do is create a directory that we're going to actually be accessing using these FTP services. So I'm going to list out to see what's inside the home directory, and it is demo pi. What that is, demo pi is the user that I'm creating, and that's the home directory for it. So that's what we're going to actually use to access the server.

So I'm actually going to look into that directory now. And we can see that there's a few things in here; ftp is not one of them. So I'm going to make a directory inside of there. So mkdir, make a directory inside home/demo. And then I'm going to create a directory within there that we're actually going to access; we'll call this files.

So now, if I list out what's inside of my demo pi directory, I can see that ftp is inside of that.

Permissions and a test file

So the next thing that I want to do is change or modify the permissions that are on that directory. So I'm going to use the chmod command and a-w — that changes the permissions of, we want to change, home/demo pi/ftp — and we are going to hit enter for that to change the permissions on that particular file.

So the next thing that I'm going to do is just create a test file, so that way we can practice downloading something. So I'm going to type in my nano program here, and I am going to create it in the home directory, in the demo pi home directory. It'll be the FTP folder, and we have that files folder, so I'll create it there. And I'm going to call it — we'll just call it maybe test.txt, how about that. And then in here, this is a test. I'm going to hit Ctrl X and save this, and save it to that location.

Restarting the service

And then let's see if we can download this. So we've made changes to our configuration file, and we also made changes to the files. Now, since we made changes to the permissions of the files and created this test file, we wouldn't need to restart after those operations. But after reconfiguring the configuration file, we do need to restart this.

So we can either restart by the reboot command and then rebooting the server, or I can restart this specific service. So I can type in sudo service vsftpd restart to restart the service. So that's what I'm going to do, and we'll get that restarted. Now all there is to do is test this out.

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →