How to let public link only access with a login account

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Public share link allows anyone with the link to download the content.

Is there any way to restrict public share links to only be accessed by logged-in users? Can we prevent anonymous access (or require users to log in to view shared content)?

I discovered a method to limit public share links to only logged-in accounts. To do this, you must modify the code located at

Simply change “@PublicPage” to “@NoAdminRequired” to achieve the desired result.

For more information about authentication in Nextcloud controllers, refer to the following link: Controllers — Nextcloud latest Developer Manual latest documentation

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.