Project

General

Profile

Owncloud cli cheatsheet » History » Revision 12

Revision 11 (Janine Ko, 08/02/2019 02:54 PM) → Revision 12/14 (Jamila Khan, 09/04/2019 04:40 PM)

{{lastupdated_at}} by {{lastupdated_by}} 

 {{>toc}} 

 h1. Owncloud cli cheatsheet 

 h2. 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 

 h2. 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 

 h2. Command line upgade procedure  

 * ssh into the server hosting the Owncloud instance  
 * go to /var/www/owncloud/updater or /var/www/nextcloud/updater 
 * run this command  
 <pre> sudo -u www-data php updater.phar </pre> 
 * wait a little bit! if it happens too fast, it didn't update.  
 * In the web console, go to Overview > Settings to see if it updated. For example: https://cloud.rainforestfoundation.org/owncloud/index.php/settings/admin/overview 
 * Refer to "documentation":https://docs.nextcloud.com/server/16/admin_manual/maintenance/update.html#using-the-command-line-based-updater if needed. 

 

 h2. Docker upgrade procedure 

 * using a docker-compose setup 
 * go to /opt/nextcloud-docker 
 * @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@ 

 
 
 h2. 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@
Go to top