Disable user access for maintenance

I’m aware of occ maintenance:mode --on but that disables access to Nextcloud for all users. Fine for upgrades.

However, I want to do some tests on a client Nextcloud install so want to disable access for everyone except me. Is this possible?

I looked at disabling users which would work except after you re-enable them, they’re logged out of the client and have to log back in. Plus there is no clue they need to do this as the client just says “Disconnected”.

As far as I know, Nextcloud itself has no such function.

The only thing I can think of off the top of my head is to temporarily restrict access at the network/firewall level, or at the proxy or web server, to a certain IP range or a certain IP.

Example for Apache:

<Directory /path/to/nextcloud>
    Order deny,allow
    Deny from all
    Allow from  # Allow a specific IP address
    Allow from    # Allow a range of IP addresses
1 Like

Good suggestion - this instance is behind nginx and yes, I’ve been able to limit access to my IP address. In nginx, you add this to the server block for the nextcloud website:

# control access by IP address
allow;        # me
deny all;
1 Like