Published on

Solving 'Failed to Get Directory Listing Permission Denied' Error in SFTPGo on macOS

Authors
  • avatar
    Name
    Ang Yi Shuan
    Twitter

When setting up SFTPGo on macOS, you might encounter a frustrating issue: after creating a user and attempting to access directories, you receive the error message "failed to get directory listing permission denied." Even though it's clear that this is a permissions issue, modifying folder permissions to read-write for everyone might not resolve the problem.

SFTPGo directory listing permission error

Said permission error shown on SFTPGo's web server.

After spending time troubleshooting and searching for solutions, I discovered that the key to solving this issue is enabling Full Disk Access for SFTPGo. This step is not mentioned in the official documentation but is crucial for macOS users. Here’s how to do it:

Step-by-Step Guide to Enable Full Disk Access for SFTPGo

  1. Open System Preferences:

    • Click the Apple menu icon in the top-left corner of your screen.
    • Select "System Preferences."
  2. Navigate to Security & Privacy:

    • In the System Preferences window, click on "Security & Privacy."
  3. Unlock the Settings:

    • Click the lock icon in the bottom-left corner of the Security & Privacy window.
    • Enter your administrator username and password to unlock the settings.
  4. Select the Privacy Tab:

    • Once unlocked, select the "Privacy" tab.
  5. Find and Select Full Disk Access:

    • In the left-hand sidebar, scroll down and select "Full Disk Access."
  6. Add SFTPGo to Full Disk Access:

    • Click the "+" button below the right-hand pane.
    • In the dialog that appears, navigate to where SFTPGo is installed (typically /usr/local/bin/sftpgo if installed via Homebrew).
    • Select SFTPGo and click "Open."
  7. Confirm Changes:

    • Ensure that SFTPGo now appears in the list of apps with Full Disk Access.
    • Make sure the checkbox next to SFTPGo is checked.
  8. Restart SFTPGo:

    • For the changes to take effect, restart SFTPGo. You can do this by stopping and starting the service again through the terminal:
      brew services stop sftpgo
      brew services start sftpgo
      

Verifying the Solution

After enabling Full Disk Access and restarting SFTPGo, try accessing the directories again. The "failed to get directory listing permission denied" error should no longer appear, and you should be able to list and access directories as expected.

Conclusion

This overlooked step in the setup process can save macOS users a lot of time and frustration. By enabling Full Disk Access for SFTPGo, you ensure that the application has the necessary permissions to access the directories required for its operation. If you encounter any other issues or have additional tips, feel free to reach out!

Happy file transferring!