Project

General

Profile

Actions

Updated almost 5 years ago by Jamila Khan

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
  • occ files:transfer-ownership USER1 USER2 -vv will transfer ownership of all files from USER1 to USER2

Command line upgade procedure

Docker upgrade procedure

  • using a docker-compose setup
  • go to nextcloud-docker folder (/opt/nextcloud-docker or /root/nextcloud-docker or wherever it was set up)
  • sudo docker-compose pull && sudo docker-compose build
  • if those two things work correctly, run docker-compose up -d
  • then sudo docker-compose exec --user www-data app php occ maintenance:mode --off

Old 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

Updated by Jamila Khan almost 5 years ago · 14 revisions

Also available in: PDF HTML TXT

Go to top