Nextcloud is an open-source, self-hosted file share and collaboration platform. Most administration is done via the occ (ownCloud Console) command-line tool.
Important: The
occcommand must be run as the web server user (usuallywww-dataon Debian/Ubuntu orapacheon RHEL/CentOS).
Basic occ Execution
Navigate to your Nextcloud directory (e.g., /var/www/nextcloud) first, or provide the full path.
# Run occ (Ubuntu/Debian)
sudo -u www-data php /var/www/nextcloud/occ
# Alias for convenience (Add to ~/.bashrc)
alias occ='sudo -u www-data php /var/www/nextcloud/occ'System and Maintenance
occ status # Show Nextcloud version and status
occ maintenance:mode --on # Enable maintenance mode (disables web access)
occ maintenance:mode --off # Disable maintenance mode
occ upgrade # Run the upgrade routine after updating filesUser Management
occ user:list # List all users
occ user:add john # Add a new user named 'john'
occ user:resetpassword john # Reset password for 'john'
occ user:disable john # Disable a user account
occ user:enable john # Enable a user account
occ user:delete john # Permanently delete a user and their dataApp Management
occ app:list # List installed and available apps
occ app:enable calendar # Enable an app
occ app:disable calendar # Disable an app
occ app:install calendar # Download and install an appFile Scanning
If you manually add files directly to the server's filesystem, Nextcloud won't see them until you scan.
occ files:scan --all # Scan files for all users (Can take a long time!)
occ files:scan john # Scan files only for user 'john'Security and Configuration
occ security:bruteforce:reset 192.168.1.50 # Unban an IP address
occ config:system:set trusted_domains 1 --value=my.nextcloud.com # Add a trusted domain