Code: Select all
How to Set Up an FTP Server (vsftpd) on a Raspberry Pi with full anonymous access
Content:
• Setup Raspberry Pi as ftp server (vsftpd) in a trusted environment
• Focus on allowing full access for anonymous users
• Allow UTF-8 filenames
• Use external (usb) media as ftp storage
◦ fat formatted
• Use unencrypted transfer
• Note: Obvious steps are not explained in detail
Infos:
• Files on the storage must
Troubleshooting
• If your server “somehow” does not work, try to use a dedicated ftp client like FileZilla. Apparently ftp servers do not provide any error messages on startup. Rather, they present their error messages to connecting clients. However, clients like Nautilus will not show you these error messages.
• For me setting up an ftp server inside /opt did not work.
References:
• https://vsftpd.beasts.org/vsftpd_conf.html
Steps:
• <> Install vsftpd
◦ What is vsftpd?
▪ “Very Secure Ftp Daemon”
◦ Why not ftpd?
▪ Because ftp user manual advices to not use ftpd
◦ The install will create an ftp user
• Setup ftp root directory (The first directory a client will jump to after calling the servers IP):
◦ <> cd /
◦ <> sudo mkdir ftpserverHome
◦ <> sudo usermod -d /ftpserverHome ftp
▪ Changes home directory of user ftp to /ftpserverHome. The root directory of the ftp server will always be the home directory of the user set up for the ftp server (which defaults to “ftp")
▪ If the home directory is not set up properly (e.g. a type), be assured, that you DO NOT get any error message. So make sure you don’t have any typos here.
• Set proper rights for ftp root directory:
◦ <> sudo chmod 444 /ftpserverHome
▪ This will set “read” rights for everyone.
▪ !! Important: Everyone must only have reading rights within the home directory! If they have writing rights, the server WILL start, but NOT WORK. You will also see NO ERROR MESSAGE, except on some clients like FileZilla.
• Set owner and group for ftp root directory
◦ <> sudo chown ftp:pi /ftpserverHome
▪ owner: ftp
▪ group: pi
• Create directory for mounting your external storage device
◦ <> mkdir /ftpserverHome/files
• Mount storage device into ftp directory
◦ Open /etc/fstab in edit mode
▪ <> sudo nano /etc/fstab
◦ Add your external device:
▪ <> /dev/sda1 /ftpserverHome/files vfat rw,exec,utf8,umask=000 0 0
• /dev/sda1 is the device’ path (this might differ on your system)
• rw: will allow read-write mode for storage (this is no device-level; the way it is mounted
• utf8: VERY IMPORTANT if you forget it, you won’t see utf-8 filenames
• umask=000: Makes all files rwx by default. umask describes the reverse numbering, that chmod uses. Therefore umask=777 => no access at all; umask=000 => full access for everyone. (As I read online) this option does only work fat formatted devices. For ext you would need a separate autostart command (e.g. /etc/rc.local) for setting access rights.
▪ <> save and exit
• Configure /etc/vsftp.conf
◦ file content:
# Make sure the connection will not break while playing a song.
idle_session_timeout=6000 # 600sec ~= 100min
data_communication_timeout=6000 # 600sec ~= 100min
# make dirs: drwxrwxrwx and files: -rw-rw-rw-
anon_umask=0000
#anon_umask is only for newly created files (rightclick → create file). It is not for copied files.
anonymous_enable=YES
# If the following is NO file and dirs can be created, but not renamed or deleted
anon_other_write_enable=YES
anon_upload_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
utf8_filesystem=YES
◦ FYI:
▪ Option “anon_upload_mode” is mentioned online, but has absolutely no effect on my machine (vsftpd version 3.03-12)
▪ Option “local_root” would set a different ftp root directory. But it only takes effect, if the login was not anonymous.
Return to “VLC for iOS, iPadOS and Apple TV”
Users browsing this forum: No registered users and 9 guests