How to let public link only access with a login account

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com 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:

example

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

longer
example
here

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 https://github.com/nextcloud/server/blob/master/apps/files_sharing/lib/Controller/ShareController.php#L317C11-L317C11

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.