DEV Community

Mahak Faheem
Mahak Faheem

Posted on

FTP Server Setup in a Windows VM

How to Set Up and Use an FTP Server in a Windows 11 VM

FTP (File Transfer Protocol) is a standard network protocol used to transfer files between clients and servers. Setting up an FTP server in a Virtual Machine (VM) on a Windows host can help keep your main operating system secure and provide a controlled environment for file transfers. This guide will walk you through the steps to set up an FTP server using IIS (Internet Information Services) on a Windows 11 VM and then demonstrate how to use the FTP command line interface to interact with it.

Step 1: Enable IIS and FTP Server Features

  1. Open Control Panel:

    • Press Windows + R, type control, and press Enter.
  2. Navigate to Programs and Features:

    • Go to Programs > Programs and Features.
    • Click on Turn Windows features on or off in the left pane.
  3. Enable IIS and FTP Server:

    • In the Windows Features dialog, expand the Internet Information Services node.
    • Expand FTP Server.
    • Check FTP Service and FTP Extensibility.
    • Ensure Web Management Tools and World Wide Web Services are also checked.
  4. Install Features:

    • Click OK and wait for the features to be installed.

Step 2: Configure the FTP Server

  1. Open IIS Manager:
    • Press Windows + R, type inetmgr, and press Enter.

Image description

  1. Add FTP Site:
    • In IIS Manager, expand the node for your computer in the Connections pane.
    • Right-click Sites and select Add FTP Site.

Image description

  1. FTP Site Details:

    • Site Name: Enter a name for your FTP site.
    • Physical Path: Select the folder you want to use for FTP file storage.
    • Click Next.
  2. Binding and SSL Settings:

    • IP Address: Select the IP address of your VM or leave it as All Unassigned.
    • Port: Default is 21.
    • SSL: For a demo, you can choose No SSL.
    • Click Next.

Image description

  1. Authentication and Authorization:
    • Authentication: Select Basic.
    • Authorization: Choose Specified users and enter your Windows username.
    • Set Permissions to Read and Write if you want to allow both uploading and downloading.
    • Click Finish.

Image description

Step 3: Configure Firewall Rules

  1. Open Windows Firewall:

    • Press Windows + R, type firewall.cpl, and press Enter.
  2. Allow FTP through Firewall:

    • Click on Advanced settings.
    • In the left pane, click Inbound Rules.
    • In the right pane, click New Rule.
    • Select Port and click Next.
    • Choose TCP and specify port 21.
    • Click Next, allow the connection, and complete the rule setup.

Image description

Step 4: Access the FTP Server

  1. Find VM's IP Address:

    • Open Command Prompt (cmd), type ipconfig, and find the IP address of your VM.
  2. Test FTP Connection:

  • You may need to turn off the VM's firewall. Do turn on back once testing is done.
  • Ensure the VM's network is set to Bridged-Adapter.

Using the FTP Command Line Interface

Let’s explore some hands-on examples using the FTP command line interface. These examples assume you have an FTP server set up and running.

  1. Connecting to an FTP Server:

    • Open Command Prompt on your Windows host machine.
    • Connect to the FTP server using its IP address:
     ftp <ftp_server_address>
    
  2. Logging In:

    • Enter your username and password:
     Name (ftp_server_address:username): your_username
     Password: your_password
    
  3. Listing Files:

    • List the files in the current directory:
     ftp> ls
    
  4. Changing Directories:

    • Change to a different directory:
     ftp> cd <directory_name>
    
  5. Downloading a File:

    • Download a file from the FTP server:
     ftp> get <file_name>
    
  6. Uploading a File:

    • Upload a file to the FTP server:
     ftp> put <file_name>
    
  7. Exiting the FTP Session:

    • Exit the FTP session:
     ftp> bye
    

Image description

Conclusion

Setting up an FTP server in a Windows 11 VM on your Windows host is a recommended practice for ensuring security and isolation. By following the steps above, you can install and configure an FTP server using IIS on a Windows 11 VM, configure necessary firewall rules, and interact with the server using the FTP command line interface from your Windows host. This setup provides a robust and secure environment for managing file transfers.

Top comments (0)