Project

General

Profile

Owncloud cli cheatsheet » History » Version 14

Jamila Khan, 11/21/2019 12:02 PM

1 1 Jessie Lee
{{lastupdated_at}} by {{lastupdated_by}}
2
3
{{>toc}}
4
5
h1. Owncloud cli cheatsheet
6
7
h2. Architecture 
8
9
* Owncloud by default is installed to /var/www/owncloud
10
* The apache conf file is in /etc/apache2/conf-available/owncloud.conf
11
** by default this redirects any http[s[://[url]/owncloud to the owncloud directory
12
** I often change this to redirect / to owncloud if on subdomain or office fileserver
13
* owncloud config file is in /var/www/owncloud/config/config.php
14
** note: if setting changes in the config file do not take, check the permissions for this file
15
* the owncloud directory also has a detailed .htaccess file that is vital to the security of owncloud
16
* The data directory can be found in the config file and is also the location of the owncloud.log file
17
** the data directory can and at office servers is often supplemented or replaced by local storage or SMB
18 2 Jessie Lee
* the backend database is mysql which is used by default for everything.
19
** some larger installs (ex. NDWA) use redis instead of mysql for file locking. 
20
* caching is performed by memcached or redis
21 3 Jessie Lee
22
h2. OCC
23
24
Occ is the cli command tool for owncloud. Through this tool most user/file/maintenance operations can be performed. 
25
detailed instructions can be found here https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/occ_command.html
26
27
key notes/favorite commands: 
28
29
* Occ must be run as the www-data user! 
30
** 8.0+ should no longer even allow running as root but if that happens there might be a permission mess to deal with!
31 6 Jessie Lee
** always use *sudo -u www-data php /var/www/owncloud/occ* (I have aliased this to occ)
32 4 Jessie Lee
* *occ upgrade* is needed for any major or minor release of owncloud!
33 3 Jessie Lee
** this will do a database upgrade test and then perform the upgrade
34
** for larger installs, this could take some time so only perform this during off hours. 
35 4 Jessie Lee
* *occ maintenance:mode --off/--on* this will gracefully close connections and turn on maintenance mode (or off)
36
* *occ file:scan [user]* this will rescan the file cache for [user] or --all for all
37 3 Jessie Lee
** 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)
38 5 Jessie Lee
* *occ user:resetpassword [user]* will allow resetting a user password
39
* *occ user:lastseen [user]* will show when the user last logged in
40
* *occ user:report* will show a report of how many users are in the system
41 14 Jamila Khan
* *occ files:transfer-ownership USER1 USER2 -vv* will transfer ownership of all files from USER1 to USER2
42 7 Jessie Lee
43 8 Janine Ko
h2. Command line upgade procedure 
44
45
* ssh into the server hosting the Owncloud instance 
46 9 Jamila Khan
* go to /var/www/owncloud/updater or /var/www/nextcloud/updater
47 8 Janine Ko
* run this command 
48
<pre> sudo -u www-data php updater.phar </pre>
49 1 Jessie Lee
* wait a little bit! if it happens too fast, it didn't update. 
50 8 Janine Ko
* 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
51 11 Janine Ko
* Refer to "documentation":https://docs.nextcloud.com/server/16/admin_manual/maintenance/update.html#using-the-command-line-based-updater if needed.
52 8 Janine Ko
53 10 Jamila Khan
h2. Docker upgrade procedure
54
55
* using a docker-compose setup
56 13 Jamila Khan
* go to nextcloud-docker folder (/opt/nextcloud-docker or /root/nextcloud-docker or wherever it was set up)
57 10 Jamila Khan
* @sudo docker-compose pull && sudo docker-compose build@
58
* if those two things work correctly, run @docker-compose up -d@
59 12 Jamila Khan
* then @sudo docker-compose exec --user www-data app php occ maintenance:mode --off@
60
61 8 Janine Ko
h2. Old Upgrade Procedure
62 1 Jessie Lee
63 8 Janine Ko
* upgrade package via apt-get 
64 7 Jessie Lee
* run @sudo -u www-data php /var/www/owncloud/occ upgrade@
65
** upgrade may take a long time
66 9 Jamila Khan
* after completing run @sudo -u www-data php /var/www/owncloud/occ maintenance:mode --off@
Go to top