Bird
Raised Fist0
Computer Networksknowledge~20 mins

FTP and SFTP for file transfer in Computer Networks - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
FTP and SFTP Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference in Security Between FTP and SFTP

Which statement best describes the main security difference between FTP and SFTP?

ASFTP encrypts both commands and data, while FTP sends data and passwords in plain text.
BFTP uses SSH for encryption, while SFTP uses SSL/TLS for encryption.
CFTP encrypts all data including passwords, while SFTP sends data in plain text.
DBoth FTP and SFTP send data without any encryption by default.
Attempts:
2 left
💡 Hint

Think about which protocol uses SSH to secure the connection.

📋 Factual
intermediate
1:30remaining
Default Ports for FTP and SFTP

What are the default network ports used by FTP and SFTP respectively?

AFTP uses port 23, SFTP uses port 20.
BFTP uses port 21, SFTP uses port 22.
CFTP uses port 20, SFTP uses port 23.
DFTP uses port 22, SFTP uses port 21.
Attempts:
2 left
💡 Hint

Remember that SFTP runs over SSH which uses a specific port.

🚀 Application
advanced
2:30remaining
Choosing Between FTP and SFTP for Secure File Transfer

You need to transfer sensitive company files over the internet. Which protocol should you choose and why?

AChoose SFTP because it encrypts data and passwords, protecting sensitive information during transfer.
BChoose FTP because it is faster and does not encrypt data, so it uses less CPU.
CChoose FTP because it uses two ports which makes it more reliable for large files.
DChoose SFTP because it sends data in plain text, making it easier to debug transfer issues.
Attempts:
2 left
💡 Hint

Consider the importance of data privacy and protection during transfer.

🔍 Analysis
advanced
2:30remaining
Impact of Firewalls on FTP and SFTP Connections

Why can FTP connections be more difficult to manage through firewalls compared to SFTP?

AFTP uses a single port making it easy to block, while SFTP uses multiple ports.
BBoth FTP and SFTP use the same ports, so firewalls treat them equally.
CSFTP requires opening many ports, while FTP only needs one port open.
DFTP uses multiple ports for control and data, requiring complex firewall rules; SFTP uses a single port.
Attempts:
2 left
💡 Hint

Think about how FTP opens separate connections for commands and data.

❓ Reasoning
expert
3:00remaining
Evaluating Protocol Choice for Automated Backup Systems

An organization wants to automate backups to a remote server. The server supports both FTP and SFTP. Considering security, firewall complexity, and automation ease, which protocol is best and why?

AFTP is best because it uses multiple ports which allow parallel transfers improving speed for backups.
BSFTP is best because it sends data in plain text, making it easier to troubleshoot automated scripts.
CSFTP is best because it provides secure encrypted transfers and uses a single port, easing firewall setup and automation.
DFTP is best because it is widely supported and easier to automate without encryption overhead.
Attempts:
2 left
💡 Hint

Balance security needs with network and automation considerations.

Practice

(1/5)
1. Which of the following statements correctly describes the main difference between FTP and SFTP?
easy
A. Neither FTP nor SFTP encrypt data during transfer.
B. SFTP encrypts data during transfer, while FTP does not.
C. Both FTP and SFTP encrypt data equally.
D. FTP encrypts data during transfer, while SFTP does not.

Solution

  1. Step 1: Understand FTP security

    FTP is an older protocol that transfers files without encryption, making data vulnerable to interception.
  2. Step 2: Understand SFTP security

    SFTP uses encryption to protect data during transfer, making it secure over untrusted networks.
  3. Final Answer:

    SFTP encrypts data during transfer, while FTP does not. -> Option B
  4. Quick Check:

    Encryption difference = SFTP encrypts, FTP does not [OK]
Hint: Remember: S in SFTP means Secure [OK]
Common Mistakes:
  • Thinking FTP encrypts data
  • Assuming both protocols are equally secure
  • Confusing FTP with FTPS (which adds SSL)
2. Which of the following is the correct command to connect to a server using SFTP in a terminal?
easy
A. ftp username@server.com
B. ssh username@server.com
C. scp username@server.com
D. sftp username@server.com

Solution

  1. Step 1: Identify SFTP command syntax

    The command to start an SFTP session is sftp username@server.com, which initiates a secure file transfer connection.
  2. Step 2: Differentiate from other commands

    ftp is for FTP connections, ssh is for remote shell access, and scp copies files but is not an interactive file transfer session.
  3. Final Answer:

    sftp username@server.com -> Option D
  4. Quick Check:

    SFTP command starts with 'sftp' [OK]
Hint: SFTP command always starts with 'sftp' [OK]
Common Mistakes:
  • Using 'ftp' instead of 'sftp' for secure transfer
  • Confusing SSH with SFTP command
  • Using SCP which is not interactive
3. Consider this Python snippet using the paramiko library to upload a file via SFTP:
import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('example.com', username='user', password='pass')
sftp = client.open_sftp()
sftp.put('local.txt', 'remote.txt')
sftp.close()
client.close()
What will happen when this code runs successfully?
medium
A. The file 'local.txt' is uploaded securely to 'remote.txt' on the server.
B. The file 'remote.txt' is downloaded to 'local.txt' on the client.
C. An error occurs because paramiko does not support SFTP.
D. The connection is made but no file transfer happens.

Solution

  1. Step 1: Understand paramiko SFTP usage

    The code connects to the server using SSH, then opens an SFTP session to transfer files securely.
  2. Step 2: Analyze the sftp.put method

    sftp.put('local.txt', 'remote.txt') uploads the local file named 'local.txt' to the server as 'remote.txt'.
  3. Final Answer:

    The file 'local.txt' is uploaded securely to 'remote.txt' on the server. -> Option A
  4. Quick Check:

    sftp.put uploads local to remote [OK]
Hint: sftp.put uploads local file to server [OK]
Common Mistakes:
  • Confusing upload with download (put vs get)
  • Thinking paramiko does not support SFTP
  • Assuming no file transfer happens without error
4. A user tries to connect to a server using SFTP but gets an error: Permission denied (publickey). What is the most likely cause?
medium
A. The SFTP command is not installed on the client machine.
B. The user typed the wrong server address.
C. The server requires a public key for authentication, but the user did not provide one.
D. The file transfer was interrupted by network issues.

Solution

  1. Step 1: Interpret the error message

    Permission denied (publickey) means the server expects a public key for login but did not accept any provided or none was given.
  2. Step 2: Rule out other causes

    Wrong server address or missing SFTP command would cause different errors. Network interruption would not cause a permission denied error.
  3. Final Answer:

    The server requires a public key for authentication, but the user did not provide one. -> Option C
  4. Quick Check:

    Public key error means missing or wrong key [OK]
Hint: Permission denied (publickey) means missing SSH key [OK]
Common Mistakes:
  • Assuming network issues cause permission denied
  • Thinking the command is missing on client
  • Confusing server address errors with authentication errors
5. You need to securely transfer multiple files from your local machine to a remote server over an untrusted network. Which approach is best to ensure security and efficiency?
hard
A. Use SFTP to transfer files directly with encryption.
B. Use FTP with a VPN connection to encrypt the data.
C. Use FTP without encryption because it's faster.
D. Use HTTP to upload files through a web browser.

Solution

  1. Step 1: Evaluate security needs

    Since the network is untrusted, encryption is necessary to protect data during transfer.
  2. Step 2: Compare transfer methods

    SFTP provides built-in encryption and secure authentication, making it ideal for secure file transfer. FTP alone is not secure, even with VPN it adds complexity. HTTP is not designed for secure file transfer.
  3. Final Answer:

    Use SFTP to transfer files directly with encryption. -> Option A
  4. Quick Check:

    SFTP = secure and efficient file transfer [OK]
Hint: Choose SFTP for secure file transfer over untrusted networks [OK]
Common Mistakes:
  • Relying on FTP without encryption
  • Assuming VPN always solves FTP security
  • Using HTTP which is not meant for file transfer
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard