File Transfer Protocol, or FTP, is a network protocol made for transferring files in a client and host fashion over a Transmission Control Protocol (TCP) network, such as the internet. FTP is integrated into most browsers, and you have probably used it before. It is a common way to host files and transfer them easily. To access an FTP, a login is required, unless the server is configured to use anonymous logins (like the Arch Linux mirrors).
In a home environment, having an FTP server can be a really cool thing. FTP is an easy way to host and share files between all of your computers, and even access your home FTP files when using Wi-Fi away from home. Beware, as FTP is an insecure protocol. A secure alternative is SFTP (SSH File Transfer Protocol).
Today in Null Byte, we are going to set up an FTP server daemon on our systems. This will allow us to:
- Share files over the internet.
- Share files outside of a Virtual Machine.
- Escape a chroot.
- Host your own file repository that can be modified by other users over the internet.
- Root privileges
- Router administrator privileges
- A router capable of port forwarding
- Some files to share
Step 1 Download & Install the Daemon
Text in bold is a command that must be entered in a terminal emulator.
First, we have to install the FTP daemon of our choice. A daemon is just a program or service that runs in the background processes. I use vsftpd (very secure FTP daemon) for my FTP server. It is light on system resources, secure, small in size, and easy to configure.
- Download the vsftpd source from the official website.
- Change to your Downloads directory.
- Configure the installation for your system.
- Compile and install vsftpd.
make && sudo make install
Step 2 Move Files to the FTP Server
- Let's move our music to FTP for the example.
sudo cp -R ~/music/* /srv/ftp/
Step 3 Configure & Start the Daemon
- Configure the daemon to not allow anonymous logging.
From =YES to =NO.
- Depending on your distro, starting services is a different command. For Ubuntu, it is service. Arch uses rc.d.
sudo rc.d start vsftpd
Step 4 Access the FTP Remotely on a Browser
Let's access our FTP from somewhere outside our network.
- Enable port forwarding for port 21.
- Go to whatismyip and write down your external IP address.
- Open up an internet browser on a computer from outside of the network and type the following into the address bar.
You can also use wget.
- Browse your music folder!
Want to start making money as a white hat hacker? Jump-start your hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from cybersecurity professionals.
Other worthwhile deals to check out: