Loading...
Linux Interview Questions

FTP (File Transfer Protocol)

1. What is FTP?
A) FTP (File Transfer Protocol) is a standard network protocol used to transfer files between a client and a server over TCP/IP.

2. Which port does FTP use?
A)Control connection: Port 21
Data connection: Port 20 (active mode) or random high ports (passive mode).

3 .What is the difference between Active and Passive FTP?
A) Active mode: Client opens a port and the server connects back to the client for data transfer.

Passive mode: Server opens a port and client connects to it. Commonly used when firewalls block incoming connections.

4 .What is the difference between FTP and SFTP?
A) FTP: No encryption, uses port 21.
SFTP: Secure (SSH-based), uses port 22. Data and credentials are encrypted.

5. What are the limitations of FTP?
A) Data is sent in plain text (unless using FTPS/SFTP).
Not firewall-friendly in active mode.

Lacks modern authentication mechanisms.

6. How do you connect to an FTP server from Linux CLI?
A)

ftp <hostname_or_ip>

7. How do you secure an FTP server?

  • Use FTPS or SFTP.
  • Disable anonymous access.
  • Restrict IPs with firewall rules.
  • Use chroot jails for users.

8. What are the common FTP server software packages?
A) Linux: vsftpd, ProFTPD, Pure-FTPd
Windows: IIS FTP Server, FileZilla Server

9. A user complains they cannot upload files to the FTP server. How do you troubleshoot?
A)

  •  Check permissions of the FTP directory.
  •  Verify user has write access.
  •  Check server config (/etc/vsftpd.conf).
  •  Review firewall and SELinux policies.

10. What logs would you check for FTP issues in Linux?
A)

  •  /var/log/vsftpd.log
  • /var/log/messages or journalctl

11. How do you test if an FTP port is open?
A)

telnet <ftp_server_ip> 21
nc -zv <ftp_server_ip> 21

12 .If FTP is not secure, why is it still used?
A)

  •   Legacy support.
  •   Simple to set up.
  •   Still useful in closed/internal networks.

13. What alternatives exist to FTP for secure file transfer?
A)

  •   SFTP (SSH File Transfer Protocol)
  •   SCP (Secure Copy)
  •   Rsync over SSH

14. FTP Connection Refused
Issue: User cannot connect to the FTP server.
Checks:
Verify FTP service is running → systemctl status vsftpd
Check port 21 is open → netstat -tulnp | grep 21
Firewall rules → firewall-cmd –list-all
SELinux restrictions.

Fix: Start/restart service, open firewall/SELinux ports.

15. 530 Login Incorrect
Issue: User gets 530 Login incorrect error.
Checks:
Verify user exists → id ftpuser
Check password → passwd ftpuser
Ensure shell is not /sbin/nologin (if needed for FTP).
Look at /etc/vsftpd.conf (local_enable=YES).
Fix: Correct credentials or enable local users.

16. Permission Denied While Uploading
Issue: User can connect but cannot upload files.
Checks:
Directory ownership/permissions → ls -ld /var/ftp/pub
Config → write_enable=YES in /etc/vsftpd.conf
SELinux → setsebool -P allow_ftpd_full_access 1
Fix: Adjust ownership and permissions, enable uploads.

17. FTP Works Locally but Not Remotely
Issue: Localhost connection works, remote fails.
Checks:

Firewall/NAT blocking passive mode.

Test with passive mode from client (passive command).

Ensure pasv_enable=YES and port range configured.

Fix: Configure passive ports and allow them in firewall.

18. Data Connection Timeout
Issue: Login works, but listing/uploading files times out.
Checks:

Passive mode ports configured (pasv_min_port, pasv_max_port).

Open those ports in firewall.

NAT device must forward passive ports.

Fix: Enable passive mode and adjust firewall rules.

19. Anonymous FTP Access Disabled
Issue: Users complain anonymous FTP stopped working.
Checks:

anonymous_enable=YES in vsftpd.conf

Check permissions on /var/ftp/pub

Fix: Re-enable anonymous access if required.

20. 530 User Cannot Login: Home Directory Inaccessible
Issue: User login fails with “Home directory inaccessible”.
Checks:
Does home directory exist? (ls -ld /home/ftpuser)
Correct permissions (chmod 755 /home/ftpuser)
Check chroot_local_user=YES.
Fix: Ensure directory exists and is accessible.

21. User Can Login but Sees Empty Directory
Issue: User logs in but sees no files.
Checks:
Wrong home directory in /etc/passwd.
Chroot jailed user but directory has no files.
Permissions not readable.
Fix: Correct home path and permissions.

22. Slow FTP Transfer Speeds
Issue: File transfers are very slow.
Checks:
Network bandwidth (iftop, nload).
Server load (top).
Encryption overhead (if FTPS).
Fix: Optimize network, adjust MTU, or use SFTP/rsync.

23. FTP Server Crashes or Hangs
Issue: FTP server stops responding.
Checks:
Logs: /var/log/vsftpd.log
System resources: dmesg, free -h, df -h
Fix: Increase file descriptors, monitor resource usage.

Leave a Reply

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