355 words
2 minutes
FTP (File Transfer Protocol)

FTP#

📒 FTP (File Transfer Protocol)#

  • Used to upload/download files between client and server.
  • Works on TCP ports 21 (control) and 20 (data).
  • Needs login credentials (unless it’s anonymous FTP).
  • FTP sends data in clear-text (not secure by default).
  • Two modes:
    • Active Mode: Server connects back to client (can be blocked by firewalls).
    • Passive Mode: Client connects to server (firewall-friendly).
  • Can use FTP programs or browser support.
  • Commands include file upload, download, delete, and directory operations.
  • Server responds with status codes (e.g., 200 = success).

📂 TFTP (Trivial File Transfer Protocol)#

  • Simpler than FTP, used for basic file transfers.
  • Works on UDP, not TCP (less reliable).
  • No login required, no password protection.
  • Only works in safe, internal networks (not for the internet).
  • Limited to files with global read/write access.
  • No directory listing support.

🛠️ Common TFTP Commands:#

CommandDescription
connectSet remote host (and port)
getDownload file(s) from server
putUpload file(s) to server
quitExit TFTP
statusShow current settings
verboseToggle detailed output

Default Configuration-vsFTPd(Very Secure FTP Daemon)#

  • One of the most popular FTP servers on Linux.
  • Default config file located at: 📁 /etc/vsftpd.conf
  • Install command:
sudo apt install vsftpd
  • Used to configure FTP settings like login access, anonymous access, logging, etc.
  • Some settings are enabled by default, others are commented out.
  • Additional options can be found in the man page:
man vsftpd.conf

🛠️ Common vsFTPd Configuration Settings#

SettingDescription
listen=NORun with inetd or standalone
listen_ipv6=YESUse IPv6
anonymous_enable=NODisable anonymous FTP
local_enable=YESAllow local Linux users to log in
dirmessage_enable=YESShow directory messages
use_localtime=YESUse system’s local time
xferlog_enable=YESEnable upload/download logs
connect_from_port_20=YESUse port 20 for data connection
secure_chroot_dir=/var/run/vsftpd/emptyRequired secure empty dir
pam_service_name=vsftpdPAM auth service name
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pemSSL cert file
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.keySSL key file
ssl_enable=NOSSL disabled by default

🚫 FTP User Deny List – /etc/ftpusers#

  • Used to block specific users from using FTP service.
  • Even if users exist on the system, they can’t log in via FTP if listed here.

🚨 Dangerous Settings – vsFTPd Anonymous Login#

Anonymous login can be useful in internal networks but is dangerous if enabled without proper restrictions.

🔐 Anonymous Access Settings in /etc/vsftpd.conf#

SettingDescription
anonymous_enable=YESAllow anonymous login
anon_upload_enable=YESAllow anonymous users to upload files
anon_mkdir_write_enable=YESAllow anonymous users to create folders
no_anon_password=YESDon’t ask for a password
anon_root=/home/username/ftpAnonymous users will land here
write_enable=YESAllow commands like upload/delete/rename

🧪 Connecting via FTP (Anonymous Login)#

ftp 10.129.14.136

🗂️ Sample Directory Listing#

ftp> ls

📋 Checking Server Status#

ftp> status

⚠️ Additional Risky Settings#

SettingDescription
dirmessage_enable=YESShow directory welcome message
chown_uploads=YESChange ownership of anonymous uploads
chown_username=usernameSet ownership to this user
local_enable=YESAllow local users to login
chroot_local_user=YESLock local users to their home dir
chroot_list_enable=YESApply chroot jail only to listed users
hide_ids=YESHide user/group IDs in listings
ls_recurse_enable=YESEnable recursive listing (ls -R)
FTP (File Transfer Protocol)
https://fuwari.vercel.app/posts/footprinting/ftp-1ddd091870808021bcc9e937ad524127/
Author
Yonten
Published at
2025-04-23