Project

General

Profile

Updated over 2 years ago by Jessie Lee

Owncloud cli cheatsheet

Architecture

  • Owncloud by default is installed to /var/www/owncloud
  • The apache conf file is in /etc/apache2/conf-available/owncloud.conf
    • by default this redirects any http[s[://[url]/owncloud to the owncloud directory
    • I often change this to redirect / to owncloud if on subdomain or office fileserver
  • owncloud config file is in /var/www/owncloud/config/config.php
    • note: if setting changes in the config file do not take, check the permissions for this file
  • the owncloud directory also has a detailed .htaccess file that is vital to the security of owncloud
  • The data directory can be found in the config file and is also the location of the owncloud.log file
    • the data directory can and at office servers is often supplemented or replaced by local storage or SMB
  • the backend database is mysql which is used by default for everything.
    • some larger installs (ex. NDWA) use redis instead of mysql for file locking.
  • caching is performed by memcached or redis

OCC

Occ is the cli command tool for owncloud. Through this tool most user/file/maintenance operations can be performed.
detailed instructions can be found here https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/occ_command.html

key notes/favorite commands:

  • Occ must be run as the www-data user!
    • 8.0+ should no longer even allow running as root but if that happens there might be a permission mess to deal with!
    • always use sudo -u www-data php /var/www/owncloud/occ (I have aliased this to occ)
  • occ upgrade is needed for any major or minor release of owncloud!
    • this will do a database upgrade test and then perform the upgrade
    • for larger installs, this could take some time so only perform this during off hours.
  • occ maintenance:mode --off/--on this will gracefully close connections and turn on maintenance mode (or off)
  • occ file:scan [user] this will rescan the file cache for [user] or --all for all
    • this doesn't work for samba shares with OC login credentials as OC has no easy capacity for caching credentials for this purpose. (currently being worked on)
  • occ user:resetpassword [user] will allow resetting a user password
  • occ user:lastseen [user] will show when the user last logged in
  • occ user:report will show a report of how many users are in the system

Upgrade Procedure
  • upgrade package via apt-get
  • run sudo -u www-data php /var/www/owncloud/occ upgrade
    • upgrade may take a long time
  • after completing run sudo -u www-data php /var/www/owncloud/occ maintenance:mode --off

Also available in: PDF HTML TXT

Go to top
Add picture from clipboard (Maximum size: 40 MB)