Knowledge Base

Why do I see an "Empty directory" message when adding a website to CodeGuard?

Overview

By the end of this article you will be able to identify which of the three common causes produced the 'Empty directory' error when adding a website to CodeGuard, and take the matching corrective action. The article explains the Capture Your Code step where the error appears, then covers each cause in turn: File Transfer Protocol / Secure File Transfer Protocol (FTP/SFTP) user permissions and the home directory created by your hosting account; website content stored outside that home directory; and server or firewall configuration, including the passive FTP data port range and the external IP address the server reports.

What is the 'Empty directory' error?

The 'Empty directory' error is a message CodeGuard displays during the Capture Your Code step of the website addition process. It means CodeGuard connected to your server but found no website files in the location it was given. The error points to an access or configuration problem, not to missing content on your website.

Common causes at a glance

CauseWhat is happeningWhere to fix it
FTP/SFTP user cannot access your filesThe user's home directory is a new, empty folder created when the user was addedYour hosting control panel, or your hosting provider
Website files are outside the home directoryContent is stored elsewhere and the home directory cannot be changedUse the workaround article for backing up files outside the home directory
Server or firewall blocks the data connectionPassive FTP data ports are closed, or the server reports an internal IP addressYour FTP server configuration and firewall

Cause 1: The FTP/SFTP user cannot access your website files

An 'Empty directory' error during the Capture Your Code step often means the File Transfer Protocol / Secure File Transfer Protocol (FTP/SFTP) user does not have access to your website files, or that your website files are not in that user's home directory.

When an FTP/SFTP user is added to a hosting account, a new, empty folder is frequently created as that user's home directory. CodeGuard then finds nothing to back up.

How to resolve it

  • Check the user's home directory. Open your hosting control panel and check the home directory assigned to the FTP/SFTP user you provided to CodeGuard.
  • Confirm the user can reach your website files. Verify that the website content you want to back up is inside that home directory.
  • Ask your hosting provider if the home directory is not visible. If the home directory is not shown in your control panel, contact your hosting provider, server administrator, or web developer to confirm that the user you provided to CodeGuard has access to the content you want to back up.

Cause 2: Your website files are stored outside the user's home directory

An 'Empty directory' error can also occur when your web content is stored outside the FTP/SFTP user's home directory and that home directory cannot be changed. CodeGuard can only see content inside the home directory it is given.

How to resolve it

Follow the steps in the article How do I back up files not in my FTP/SFTP user's home directory? to work around this limitation.

Cause 3: The server or firewall blocks the data connection

An 'Empty directory' error can also occur when your FTP/SFTP server or firewall is not configured to allow a data connection to be opened. Two settings commonly cause this.

Passive FTP data ports. In addition to port 21, passive FTP requires a further range of ports for data transfer. This range is specified in your FTP server configuration and must be added to your firewall.

External IP address. The host address or IP configured in the FTP/SFTP server must be the external IP address of your server. If the external address is not specified, the server instructs CodeGuard to open a data connection back to an internal IP address — for example an address in the 10.x.x.x, 192.x.x.x, or 172.x.x.x ranges — which CodeGuard cannot reach.

How to resolve it

  • Find the passive port range. Check your FTP server configuration for the data transfer port range it uses.
  • Open that range on your firewall. Add the port range, along with port 21, to your firewall rules.
  • Set the external IP address. Configure the host address or IP in your FTP/SFTP server to the external IP address of your server, not an internal address.

How to verify the problem is resolved

Add the website again in CodeGuard and complete the Capture Your Code step. The problem is resolved when the step completes without an 'Empty directory' error and your website files are listed for backup. If the error appears again, work through the remaining causes above.

Frequently asked questions

What does the 'Empty directory' error mean in CodeGuard?

It means CodeGuard connected to your server during the Capture Your Code step but found no website files in the location it was given. It indicates an access or configuration problem rather than missing website content.

Why is my FTP/SFTP user's home directory empty?

When an FTP/SFTP user is added to a hosting account, a new, empty folder is frequently created as that user's home directory. Your website files may be stored elsewhere on the server.

What should I do if my website files are outside the FTP/SFTP user's home directory?

If the home directory cannot be changed, follow the article How do I back up files not in my FTP/SFTP user's home directory? to work around the limitation.

Which ports does CodeGuard need for passive FTP?

In addition to port 21, passive FTP requires the data transfer port range specified in your FTP server configuration. That range must be added to your firewall.

Why must my server report an external IP address?

If the external address is not specified, the server instructs CodeGuard to open a data connection back to an internal IP address, which CodeGuard cannot reach.

Similar questions

  • CodeGuard says empty directory when adding my website
  • Why can't CodeGuard find my website files?
  • FTP user home directory is empty in CodeGuard
  • CodeGuard passive FTP firewall port configuration
  • Capture Your Code step fails with no files found

Related articles

Need assistance?

Contact our team for help with your purchase or issuing your certificate.

Live chat

Call us today