Categories
Tags
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:
Command | Description |
---|---|
connect | Set remote host (and port) |
get | Download file(s) from server |
put | Upload file(s) to server |
quit | Exit TFTP |
status | Show current settings |
verbose | Toggle 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
Setting | Description |
---|---|
listen=NO | Run with inetd or standalone |
listen_ipv6=YES | Use IPv6 |
anonymous_enable=NO | Disable anonymous FTP |
local_enable=YES | Allow local Linux users to log in |
dirmessage_enable=YES | Show directory messages |
use_localtime=YES | Use system’s local time |
xferlog_enable=YES | Enable upload/download logs |
connect_from_port_20=YES | Use port 20 for data connection |
secure_chroot_dir=/var/run/vsftpd/empty | Required secure empty dir |
pam_service_name=vsftpd | PAM auth service name |
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem | SSL cert file |
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key | SSL key file |
ssl_enable=NO | SSL 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
Setting | Description |
---|---|
anonymous_enable=YES | Allow anonymous login |
anon_upload_enable=YES | Allow anonymous users to upload files |
anon_mkdir_write_enable=YES | Allow anonymous users to create folders |
no_anon_password=YES | Don’t ask for a password |
anon_root=/home/username/ftp | Anonymous users will land here |
write_enable=YES | Allow 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
Setting | Description |
---|---|
dirmessage_enable=YES | Show directory welcome message |
chown_uploads=YES | Change ownership of anonymous uploads |
chown_username=username | Set ownership to this user |
local_enable=YES | Allow local users to login |
chroot_local_user=YES | Lock local users to their home dir |
chroot_list_enable=YES | Apply chroot jail only to listed users |
hide_ids=YES | Hide user/group IDs in listings |
ls_recurse_enable=YES | Enable recursive listing (ls -R ) |
FTP (File Transfer Protocol)
https://fuwari.vercel.app/posts/footprinting/ftp-1ddd091870808021bcc9e937ad524127/