How to Run an FTP Server from Home with Linux

Nov 18, 2011 07:07 AM

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

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.

  1. Download the vsftpd source from the official website.
  2. Change to your Downloads directory.

       cd ~/Downloads
  3. Configure the installation for your system.

    ./configure
  4. Compile and install vsftpd.

    make && sudo make install

Move Files to the FTP Server

  1. Let's move our music to FTP for the example.

    sudo cp -R ~/music/* /srv/ftp/

Configure & Start the Daemon

  1. Configure the daemon to not allow anonymous logging.

        From =YES to =NO.
  2. Depending on your distro, starting services is a different command. For Ubuntu, it is service. Arch uses rc.d.

    sudo rc.d start vsftpd

Access the FTP Remotely on a Browser

Let's access our FTP from somewhere outside our network.

  1. Enable port forwarding for port 21.
  2. Go to whatismyip and write down your external IP address.
  3. Open up an internet browser on a computer from outside of the network and type the following into the address bar.

        ftp:///music/

    You can also use wget.

        wget ftp:///music/

  4. 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.

Image via webmastersbydesign

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Comments

No Comments Exist

Be the first, drop a comment!