Quick Reference

Cheatsheets

Practical command references for Linux, networking, servers, containers, databases, and more.

Cheatsheet#owncloud-cheatsheet

ownCloud Cheatsheet

ownCloud is an open-source file sync and share solution. Similar to Nextcloud (which was forked from it), administration is heavily reliant on the occ command-line tool.

Installation Basics

ownCloud requires a standard LAMP stack.

# Common prerequisites (Debian/Ubuntu)
sudo apt install apache2 mariadb-server
sudo apt install php php-intl php-mysql php-mbstring php-imagick php-igbinary php-gmp php-bcmath php-curl php-gd php-zip php-xml
 
# Download and extract
wget https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2
tar -xjvf owncloud-complete-latest.tar.bz2
sudo cp -r owncloud /var/www/
sudo chown -R www-data:www-data /var/www/owncloud

Basic occ Execution

Important: The occ command must be run as the web server user (usually www-data on Debian/Ubuntu or apache on RHEL/CentOS).

# Run occ (Ubuntu/Debian)
sudo -u www-data php /var/www/owncloud/occ
 
# Run occ (RHEL/CentOS)
sudo -u apache php /var/www/html/owncloud/occ

User Management

# List all users
sudo -u www-data php occ user:list
 
# Add a new user
sudo -u www-data php occ user:add username
 
# Reset user password
sudo -u www-data php occ user:resetpassword username
 
# Disable a user
sudo -u www-data php occ user:disable username
 
# Delete a user
sudo -u www-data php occ user:delete username
 
# Show user report (disk quota, status)
sudo -u www-data php occ user:report username

App Management

# List all apps
sudo -u www-data php occ app:list
 
# Enable an app
sudo -u www-data php occ app:enable app_id
 
# Disable an app
sudo -u www-data php occ app:disable app_id

File Scanning

If you manually move files into an ownCloud user's data directory via the command line, you must scan them so ownCloud knows they exist.

# Scan files for all users
sudo -u www-data php occ files:scan --all
 
# Scan files for a specific user
sudo -u www-data php occ files:scan username

Maintenance Mode and Upgrades

# Enable maintenance mode
sudo -u www-data php occ maintenance:mode --on
 
# Disable maintenance mode
sudo -u www-data php occ maintenance:mode --off
 
# Run the upgrade routine
sudo -u www-data php occ upgrade

Background Jobs (Cron)

System cron is the recommended way to execute ownCloud background jobs. Add to the www-data crontab (sudo -u www-data crontab -e):

# Run every 15 minutes
*/15 * * * * /usr/bin/php -f /var/www/owncloud/occ system:cron

System Configuration

# Show current config
sudo -u www-data php occ config:system:get
 
# Set a config value (e.g., add a trusted domain)
sudo -u www-data php occ config:system:set trusted_domains 1 --value="owncloud.example.com"