FTP

From Bibliotheca Anonoma
Revision as of 14:34, 30 January 2018 by Antonizoon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FTP is the File Transfer Protocol, a longtime method of transferring files across the internet with directory management.

However, it can be a bit difficult to set up, and read-only access is strongly recommended.

An easier, safer, more accessible alternative would be WebDAV, which uses HTTP servers, has significant performance improvements over FTP..

Note: Make sure your FTP server is read-only. It is not recommended to use FTP to write files (use SFTP instead).

You have the option of either making the FTP anonymous (anybody in the world can download), or login required (using a special FTP user with a password).

VSFTP Setup Guide

Streaming Video from FTP Server

First, open the FTP server in a browser using ftp:// . Next, copy the URL of the video to play. Finally, follow these instructions to stream them in your favorite media player.

  • VLC or Media Player Classic
  • First, open the FTP server in a browser. You can do this using ftp:// .
  • Next, copy the URL of the video to play.
  • Finally, click Open Network Stream (or Open File?), and paste the video URL.
  • Android + MX Player

Anonymous FTP Server

In an Anonymous FTP Server, anyone in the world can access and download from the FTP server (but cannot upload).

http://www.g-loaded.eu/2008/12/02/set-up-an-anonymous-ftp-server-with-vsftpd-in-less-than-a-minute/

Create FTP User

Alternatively, if you don't want public access, you can create a read-only FTP account (with no SSH privileges). Create such a user with this command:

sudo useradd -m -G ftp -s /sbin/nologin -d /home/ftpuser ftpuser

VSFTP's most famous security feature is the user chroot, which ensures that FTP users can only access their own home directory. This is absolutely critical if your server is exposed to the outside internet, functioning as a second line of defense in case your user password is compromised.

Add these lines to the end of /etc/vsftpd.conf .

chroot_local_user=YES
allow_writeable_chroot=YES

Dynamic DNS Address

If you are using a Dynamic DNS address instead of an IP, make sure to specify it in /etc/vsftpd.conf :

# Dynamic DNS Address
pasv_addr_resolve=YES
pasv_address=yourserver.com

Enable FTP Passive Mode

FTP Passive Mode uses multiple ports (for various reasons) instead of just TCP Port 21, and it is strongly recommended to enable it.

However, you will need to port forward a large port range to make this possible.

First, edit /etc/vsftpd.conf, and add these settings to set a specific port range for FTP Passive Mode.

port_enable=YES
pasv_min_port=65400
pasv_max_port=65534

Next, if you are using a router (if it can transmit WiFi, it is a router), make sure to port forward TCP Port 21 and the port range selected (in this case, TCP 65400-65534). After you restart VSFTP, FTP Passive Mode will work.