温馨提示×

FileZilla在Debian的远程连接设置

小樊
42
2025-11-09 04:15:55
栏目: 智能运维

Installing FileZilla on Debian
To use FileZilla for remote connections, first install it on your Debian system. Open a terminal and run:

sudo apt update && sudo apt install filezilla

Verify installation with sudo dpkg -l | grep filezilla—you should see a FileZilla entry if successful.

Configuring Remote Connection in FileZilla (Client Mode)

  1. Open Site Manager: Launch FileZilla and click the “Site Manager” icon (or go to File > Site Manager).
  2. Create a New Site: Click “New Site,” name it (e.g., “Debian Remote Server”), and configure these settings:
    • Protocol: Choose SFTP (recommended for security) or FTP (traditional, less secure).
    • Host: Enter the remote server’s IP address or domain name.
    • Port: Use 22 for SFTP (default) or 21 for FTP.
    • Login Type: Select “Normal” (for username/password auth) or “Key File” (for SSH keys).
    • Username/Password: Input your remote server’s credentials (for key auth, browse to your private key file).
  3. Connect: Click “Connect.” If successful, the right panel will display the remote server’s files, while the left shows your local files.

Setting Up FileZilla Server on Debian (For Hosting Files)
If you need to host files for others to connect to, install FileZilla Server:

  1. Install Server: Download the Debian package from the official site and install it:
    wget https://dl3.cdn.filezilla-project.org/server/FileZilla_Server_xxx_x86_64-linux-gnu.deb
    sudo dpkg -i FileZilla_Server_xxx_x86_64-linux-gnu.deb
    
  2. Start the Server: Enable and start the service:
    sudo systemctl enable filezilla-server
    sudo systemctl start filezilla-server
    
  3. Configure Users & Permissions:
    • Edit the server config file (/etc/filezilla/filezilla.xml) or use the FileZilla Server Interface (GUI).
    • Under <Users>, add a user with permissions (read/write/delete) and a home directory:
      <User>
          <Name>remote_user</Name>
          <Password>secure_password</Password>
          <HomeDirectory>/home/remote_user</HomeDirectory>
          <Permissions><Read>True</Read><Write>True</Write></Permissions>
      </User>
      
  4. Configure Passive Mode: For firewall compatibility, set a passive port range (e.g., 50000-51000) in the <Server> section:
    <PassivePorts>50000-51000</PassivePorts>
    
  5. Adjust Firewall: Allow FTP (port 21) and passive mode ports (e.g., 50000-51000) using UFW:
    sudo ufw allow 21/tcp
    sudo ufw allow 50000:51000/tcp
    sudo ufw reload
    
  6. Test Connection: Use FileZilla Client to connect to your server’s IP, using the configured username/password and port.

Key Tips for Success

  • Security: Prefer SFTP (SSH) over FTP (plaintext) and use SSH keys instead of passwords.
  • Firewall: Ensure your Debian firewall (UFW) or router allows the necessary ports (21/22 for FTP/SFTP, passive ports for data transfer).
  • Passive Mode: Critical for connections behind NAT/firewalls—configure both the server and client with matching port ranges.

0