Installing an FTP server on RPi 2 running ubuntu

My RPi 2 is running Ubuntu-trusty from here, and I needed to add an FTP server. The FTP server will host a folder on a ntfs USB drive. Initially I tried vsftpd, but the vsftpd FTP server sucks and I ended up using a different FTP, proftpd. What I did was loosely based around these instructions.

  1. install proftpd from a terminal window:
    sudo apt-get update
    sudo apt-get install proftpd

    (when a window popped up, I (eventually) I installed as a service since the other option requires more stuff I haven’t installed)

  2. Modify config file using nano text editor:
    sudo nano /etc/proftpd/proftpd.conf

    I changed ServerName to my RPi hostname, set ServerType as standalone and un-commented DefaultRoot to prevent users from going up a directory (full access to everything.. :/ ).

  3. Update hosts file to work with proftpd
    sudo nano /etc/hosts

    add this to the bottom (correctly…)

    my_ip_address         my_hostname
  4. Create a user account for ftp (removing ssh access)
    sudo useradd newuser

    add a password

    passwd newuser

    change their home directory to the FTP directory:

    sudo usermod -d /media/Data/ftp newuser

    where /media/Data is the mount point for my ntfs USB drive, explained here (step 2 in the second set of instructions).
    I also added the new user to my ubuntu group, since the ubuntu group is the owner of my nfts drive (not sure if this was required):

    sudo usermod -a -G ubuntu newuser
  5. Remove SSH access for new user:
    Add this line

    /bin/false

    in /etc/shells file with nano texteditor:

    sudo nano /etc/shells

    run this in terminal:

    sudo usermod -s /bin/false newuser

    Finished 😀

    Server can be controlled with these commands:

    sudo /etc/init.d/proftpd start
    sudo /etc/init.d/proftpd stop
    sudo /etc/init.d/proftpd restart

Leave a Reply

Your email address will not be published. Required fields are marked *