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.
Requirements
- Linux
- 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.
cd ~/Downloads - Configure the installation for your system.
./configure - 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.
ftp://<ip address>/music/
You can also use wget.
wget ftp://<ipaddress>/music/ - Browse your music folder!
Have fun playing with your own FTP server! Visit the Null Byte IRC and chat with all of us. You can also follow me on Twitter and Google+ for updates.
Just updated your iPhone? You'll find new features for TV, Messages, News, and Shortcuts, as well as important bug fixes and security patches. Find out what's new and changed on your iPhone with the iOS 17.6 update.
5 Comments
I like
:) Thanks.
no glFTPd ? hehe
I would have added it, but since it requires extensive scripting, it would be impratical for inexperienced users :(.
I'm not Root :-( any solution?
Share Your Thoughts