From 495247ae4a7b67d4f1881d42dcdb84294f24b1d3 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 29 Apr 2025 10:16:49 +0200 Subject: [PATCH] standardize occ command documentation Use `sudo -E -u www-data php occ` everywhere. Motivation: this should work on more appliances like also inside docker containers. Signed-off-by: Simon L. --- admin_manual/ai/app_assistant.rst | 2 +- admin_manual/ai/app_summary_bot.rst | 4 +- admin_manual/ai/overview.rst | 6 +- .../bigint_identifiers.rst | 6 +- .../configuration_database/db_conversion.rst | 6 +- .../mysql_4byte_support.rst | 8 +- .../big_file_upload_configuration.rst | 2 +- .../external_storage/local.rst | 2 +- .../external_storage_configuration_gui.rst | 2 +- .../configuration_mimetypes/index.rst | 4 +- .../antivirus_configuration.rst | 10 +- .../config_sample_php_parameters.rst | 2 +- .../configuration_user/authentication.rst | 4 +- .../reset_admin_password.rst | 2 +- .../configuration_user/two_factor-auth.rst | 6 +- .../configuration_user/user_auth_ldap.rst | 14 +- .../user_auth_ldap_cleanup.rst | 10 +- admin_manual/groupware/calendar.rst | 22 +- admin_manual/groupware/contacts.rst | 8 +- .../command_line_installation.rst | 2 +- .../installation/php_configuration.rst | 2 +- .../installation/source_installation.rst | 2 +- admin_manual/issues/applying_patch.rst | 2 +- .../issues/general_troubleshooting.rst | 6 +- admin_manual/maintenance/backup.rst | 2 +- admin_manual/maintenance/manual_upgrade.rst | 10 +- admin_manual/maintenance/update.rst | 6 +- admin_manual/maintenance/upgrade.rst | 10 +- admin_manual/occ_command.rst | 312 +++++++++--------- admin_manual/webhook_listeners/index.rst | 6 +- developer_manual/digging_deeper/profiler.rst | 2 +- .../faq/BehindCompanyProxy.rst | 6 +- .../tech_details/Deployment.rst | 4 +- style_guide.rst | 4 +- 34 files changed, 247 insertions(+), 249 deletions(-) diff --git a/admin_manual/ai/app_assistant.rst b/admin_manual/ai/app_assistant.rst index 92490a87f..89796d6f1 100644 --- a/admin_manual/ai/app_assistant.rst +++ b/admin_manual/ai/app_assistant.rst @@ -17,7 +17,7 @@ You can install the *assistant* app via the "Apps" page in Nextcloud, or by exec .. code-block:: - php occ app:enable assistant + sudo -E -u www-data php occ app:enable assistant App store --------- diff --git a/admin_manual/ai/app_summary_bot.rst b/admin_manual/ai/app_summary_bot.rst index 38d087a1d..aaf72c4e9 100644 --- a/admin_manual/ai/app_summary_bot.rst +++ b/admin_manual/ai/app_summary_bot.rst @@ -87,7 +87,7 @@ After cloning this app *manually* (cloned via git to your apps directory) you wi .. code-block:: - sudo -u php /path/to/your/nextcloud/webroot/occ app_api:app:unregister summary_bot + sudo -E -u www-data php occ app_api:app:unregister summary_bot 5. Register the Summary Bot so that your Nextcloud instance is aware of it @@ -96,7 +96,7 @@ After cloning this app *manually* (cloned via git to your apps directory) you wi .. code-block:: - sudo -u php ./occ app_api:app:register summary_bot manual_install --json-info '{ "id": "summary_bot", "name": "Summary Bot", "daemon_config_name": "manual_install", "version": "1.0.0", "secret": "12345", "host": "0.0.0.0", "port": 9031, "scopes": ["AI_PROVIDERS", "TALK", "TALK_BOT"], "protocol": "http"}' --force-scopes --wait-finish + sudo -E -u www-data php occ app_api:app:register summary_bot manual_install --json-info '{ "id": "summary_bot", "name": "Summary Bot", "daemon_config_name": "manual_install", "version": "1.0.0", "secret": "12345", "host": "0.0.0.0", "port": 9031, "scopes": ["AI_PROVIDERS", "TALK", "TALK_BOT"], "protocol": "http"}' --force-scopes --wait-finish 6. Enable the *Summary Bot* for the selected Chatroom via the three dots menu of the Chatroom (The Bots settings are located inside the *Bots* section) diff --git a/admin_manual/ai/overview.rst b/admin_manual/ai/overview.rst index 099ff0367..cf1e2be87 100644 --- a/admin_manual/ai/overview.rst +++ b/admin_manual/ai/overview.rst @@ -218,13 +218,13 @@ It would be best to run one command per screen session or per tmux window/pane t .. code-block:: - set -e; while true; do sudo -u www-data occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done + set -e; while true; do sudo -E -u www-data php occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done For Nextcloud-AIO you should use this command on the host server. .. code-block:: - set -e; while true; do docker exec -u www-data -it nextcloud-aio-nextcloud php occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done + set -e; while true; do docker exec -it nextcloud-aio-nextcloud sudo -E -u www-data php occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done You may want to adjust the number of workers and the timeout (in seconds) to your needs. The logs of the worker can be checked by attaching to the screen or tmux session. @@ -256,7 +256,7 @@ Systemd service #!/bin/sh echo "Starting Nextcloud AI Worker $1" cd /path/to/nextcloud - sudo -u www-data php occ background-job:worker -t 60 'OC\TaskProcessing\SynchronousBackgroundJob' + sudo -E -u www-data php occ background-job:worker -t 60 'OC\TaskProcessing\SynchronousBackgroundJob' You may want to adjust the timeout to your needs (in seconds). diff --git a/admin_manual/configuration_database/bigint_identifiers.rst b/admin_manual/configuration_database/bigint_identifiers.rst index aabf5bd1d..aeba768b6 100644 --- a/admin_manual/configuration_database/bigint_identifiers.rst +++ b/admin_manual/configuration_database/bigint_identifiers.rst @@ -9,18 +9,18 @@ and activity table has to be triggered manually by a console command. The command can safely be executed. It will show a success message when there is nothing to do:: - sudo -u www-data php occ db:convert-filecache-bigint + sudo -E -u www-data php occ db:convert-filecache-bigint All tables already up to date! or otherwise ask for confirmation, before performing the heavy actions:: - sudo -u www-data php occ db:convert-filecache-bigint + sudo -E -u www-data php occ db:convert-filecache-bigint This can take up to hours, depending on the number of files in your instance! Continue with the conversion (y/n)? [n] to suppress the confirmation message append ``--no-interaction`` to the argument list:: - sudo -u www-data php occ db:convert-filecache-bigint --no-interaction + sudo -E -u www-data php occ db:convert-filecache-bigint --no-interaction .. note:: Similar to a normal update, you should shutdown your Apache or nginx server or enable maintenance diff --git a/admin_manual/configuration_database/db_conversion.rst b/admin_manual/configuration_database/db_conversion.rst index ae9977170..f576ed3bf 100644 --- a/admin_manual/configuration_database/db_conversion.rst +++ b/admin_manual/configuration_database/db_conversion.rst @@ -34,7 +34,7 @@ The ``occ db:convert-type`` command handles all the tasks of the conversion. The :: - php occ db:convert-type [options] type username hostname database + sudo -E -u www-data php occ db:convert-type [options] type username hostname database ``type`` should be the target database type. The same values are available here as for the ``config.php`` ``dbtype`` parameter. It should be one of: ``mysql`` for MariaDB/MySQL, ``pgsql`` for PostgreSQL, or ``oci`` for Oracle. @@ -55,7 +55,7 @@ Let's convert our existing (functioning) sqlite3 installation to be MariaDB/MySQ :: - php occ db:convert-type --password="" --port="3306" --all-apps mysql nextcloud + sudo -E -u www-data php occ db:convert-type --password="" --port="3306" --all-apps mysql nextcloud .. note:: It was unnecessary to specify the port in this example because ``3306`` is already the default. We did so merely for demonstration purposes and completeness in case the reader is using a non-standard port on their target @@ -68,7 +68,7 @@ If you are converting to a MySQL/MariaDB database, you will also want to set ``m :: - php occ config:system:set mysql.utf8mb4 --type boolean --value="true" + sudo -E -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true" If you like, you can view the changes that were made by looking for the ``db*`` parameters in your ``config.php`` (you could also use this command before doing the conversion to compare your configuration before/after): diff --git a/admin_manual/configuration_database/mysql_4byte_support.rst b/admin_manual/configuration_database/mysql_4byte_support.rst index 3c209845e..02c7cd0d2 100644 --- a/admin_manual/configuration_database/mysql_4byte_support.rst +++ b/admin_manual/configuration_database/mysql_4byte_support.rst @@ -43,7 +43,7 @@ The result should look like this:: 3. Open a shell, change dir (adjust ``/var/www/nextcloud`` to your nextcloud location if needed), and put your nextcloud instance in maintenance mode, if it isn't already:: $ cd /var/www/nextcloud - $ sudo -u www-data php occ maintenance:mode --on + $ sudo -E -u www-data php occ maintenance:mode --on 4. Change your databases character set and collation: @@ -53,11 +53,11 @@ The result should look like this:: 5. Set the ``mysql.utf8mb4`` config to true in your config.php:: - $ sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true" + $ sudo -E -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true" 6. Convert all existing tables to the new collation by running the repair step:: - $ sudo -u www-data php occ maintenance:repair + $ sudo -E -u www-data php occ maintenance:repair .. note:: @@ -65,7 +65,7 @@ The result should look like this:: 7. Disable maintenance mode:: - $ sudo -u www-data php occ maintenance:mode --off + $ sudo -E -u www-data php occ maintenance:mode --off Now you should be able to use Emojis in your file names, calendar events, comments and many more. diff --git a/admin_manual/configuration_files/big_file_upload_configuration.rst b/admin_manual/configuration_files/big_file_upload_configuration.rst index fd576ac90..9e21ea3c8 100644 --- a/admin_manual/configuration_files/big_file_upload_configuration.rst +++ b/admin_manual/configuration_files/big_file_upload_configuration.rst @@ -159,7 +159,7 @@ Adjust chunk size on Nextcloud side For upload performance improvements in environments with high upload bandwidth, the server's upload chunk size may be adjusted:: - sudo -u www-data php occ config:system:set --type int --value 20971520 files.chunked_upload.max_size + sudo -E -u www-data php occ config:system:set --type int --value 20971520 files.chunked_upload.max_size Put in a value in bytes (in this example, 20MB). Set ``--value 0`` for no chunking at all. diff --git a/admin_manual/configuration_files/external_storage/local.rst b/admin_manual/configuration_files/external_storage/local.rst index 10b14029e..b9dfa45ff 100644 --- a/admin_manual/configuration_files/external_storage/local.rst +++ b/admin_manual/configuration_files/external_storage/local.rst @@ -17,7 +17,7 @@ are on Ubuntu Linux:: Important: If you use consecutive commands, make sure, you are user ``www-data``:: - sudo -u www-data bash + sudo -E -u www-data bash cd /path/to/localdir mkdir data diff --git a/admin_manual/configuration_files/external_storage_configuration_gui.rst b/admin_manual/configuration_files/external_storage_configuration_gui.rst index ad38f0a5e..0529d1a21 100644 --- a/admin_manual/configuration_files/external_storage_configuration_gui.rst +++ b/admin_manual/configuration_files/external_storage_configuration_gui.rst @@ -158,7 +158,7 @@ Nextcloud may not always be able to find out what has been changed remotely (files changed without going through Nextcloud), especially when it's very deep in the folder hierarchy of the external storage. -You might need to setup a cron job that runs ``sudo -u www-data php occ files:scan --all`` +You might need to setup a cron job that runs ``sudo -E -u www-data php occ files:scan --all`` (or replace ``--all`` with the user name, see also :doc:`../occ_command`) to trigger a rescan of the user's files periodically (for example every 15 minutes), which includes the mounted external storage. diff --git a/admin_manual/configuration_mimetypes/index.rst b/admin_manual/configuration_mimetypes/index.rst index 8b47f2e40..aab6db1ea 100644 --- a/admin_manual/configuration_mimetypes/index.rst +++ b/admin_manual/configuration_mimetypes/index.rst @@ -20,10 +20,10 @@ Once you have made changes to your ``mimetypealiases.json``, use the ``occ`` command to propagate the changes through the system. This example is for Ubuntu Linux:: - $ sudo -u www-data php occ maintenance:mimetype:update-js + $ sudo -E -u www-data php occ maintenance:mimetype:update-js # you may also need to update the mimetype for existing files, see nextcloud/server#30566 - $ sudo -u www-data php occ maintenance:mimetype:update-db --repair-filecache + $ sudo -E -u www-data php occ maintenance:mimetype:update-db --repair-filecache See :doc:`../occ_command` to learn more about ``occ``. diff --git a/admin_manual/configuration_server/antivirus_configuration.rst b/admin_manual/configuration_server/antivirus_configuration.rst index 1a1b3ddd0..7e4a7fb0c 100644 --- a/admin_manual/configuration_server/antivirus_configuration.rst +++ b/admin_manual/configuration_server/antivirus_configuration.rst @@ -189,7 +189,7 @@ Get info about files in the scan queue :: - sudo -u www php occ files_antivirus:status [-v] + sudo -E -u www-data php occ files_antivirus:status [-v] Manually trigger the background scan @@ -197,21 +197,21 @@ Manually trigger the background scan :: - sudo -u www php occ files_antivirus:background-scan [-v] [-m MAX] + sudo -E -u www-data php occ files_antivirus:background-scan [-v] [-m MAX] Manually scan a single file ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: - sudo -u www php occ files_antivirus:scan + sudo -E -u www-data php occ files_antivirus:scan Mark a file as scanned or unscanned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: - sudo -u www php occ files_antivirus:mark + sudo -E -u www-data php occ files_antivirus:mark Files marked as scanned will not be scanned for the next four weeks. @@ -230,4 +230,4 @@ Disabling background scan task You can disable background scan with occ to only scan files during upload:: - sudo -u www php occ config:app:set files_antivirus av_background_scan --value="off" + sudo -E -u www-data php occ config:app:set files_antivirus av_background_scan --value="off" diff --git a/admin_manual/configuration_server/config_sample_php_parameters.rst b/admin_manual/configuration_server/config_sample_php_parameters.rst index 46dd2626b..4d46105c9 100644 --- a/admin_manual/configuration_server/config_sample_php_parameters.rst +++ b/admin_manual/configuration_server/config_sample_php_parameters.rst @@ -3497,7 +3497,7 @@ Allows to create external storages of type "Local" in the web interface and APIs When disabled, it is still possible to create local storages with occ using the following command: -% php occ files_external:create /mountpoint local null::null -c datadir=/path/to/data +% sudo -E -u www-data php occ files_external:create /mountpoint local null::null -c datadir=/path/to/data Defaults to ``true`` diff --git a/admin_manual/configuration_user/authentication.rst b/admin_manual/configuration_user/authentication.rst index cc2ca16c6..c02e73638 100644 --- a/admin_manual/configuration_user/authentication.rst +++ b/admin_manual/configuration_user/authentication.rst @@ -22,7 +22,7 @@ Nextcloud will delete unused passwords. Passwords set for *remote wipe* are dele The time spans can be overwritten with configuration:: - php occ config:system:set token_auth_wipe_token_retention --type=int --value 2592000 # 60*60*24*30 - 30 days - php occ config:system:set token_auth_token_retention --type=int --value 63072000 # 60*60*24*365*2 - 2 years + sudo -E -u www-data php occ config:system:set token_auth_wipe_token_retention --type=int --value 2592000 # 60*60*24*30 - 30 days + sudo -E -u www-data php occ config:system:set token_auth_token_retention --type=int --value 63072000 # 60*60*24*365*2 - 2 years Values are set in **seconds**. \ No newline at end of file diff --git a/admin_manual/configuration_user/reset_admin_password.rst b/admin_manual/configuration_user/reset_admin_password.rst index f3ca77710..6c333fc44 100644 --- a/admin_manual/configuration_user/reset_admin_password.rst +++ b/admin_manual/configuration_user/reset_admin_password.rst @@ -17,7 +17,7 @@ learn more about using the ``occ`` command. :: - $ sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin + $ sudo -E -u www-data php /var/www/nextcloud/occ user:resetpassword admin Enter a new password: Confirm the new password: Successfully reset password for admin diff --git a/admin_manual/configuration_user/two_factor-auth.rst b/admin_manual/configuration_user/two_factor-auth.rst index 4d2fb8cd5..46861aaf2 100644 --- a/admin_manual/configuration_user/two_factor-auth.rst +++ b/admin_manual/configuration_user/two_factor-auth.rst @@ -82,7 +82,7 @@ Nextcloud will still consider the provider active for the user at login and show The associations of removed providers can be cleaned up via :ref:`occ `:: - sudo -u www-data php occ twofactorauth:cleanup + sudo -E -u www-data php occ twofactorauth:cleanup .. warning:: This operation is irreversible. Only run it for providers you do not intend to enable again as then you have to setup the configuration for all users from scratch. @@ -92,7 +92,7 @@ Disabling two-factor authentication Two-factor providers can be disabled via :ref:`occ `:: - sudo -u www-data php occ twofactorauth:disable + sudo -E -u www-data php occ twofactorauth:disable This can be useful if the user forgot or lost their second factor. Afterwards users are free to enable this provider again via their personal settings. @@ -101,4 +101,4 @@ Afterwards users are free to enable this provider again via their personal setti It is also possible to check the current two-factor user status via :ref:`occ `:: - sudo -u www-data php occ twofactorauth:state + sudo -E -u www-data php occ twofactorauth:state diff --git a/admin_manual/configuration_user/user_auth_ldap.rst b/admin_manual/configuration_user/user_auth_ldap.rst index 98770f97b..85b9da209 100644 --- a/admin_manual/configuration_user/user_auth_ldap.rst +++ b/admin_manual/configuration_user/user_auth_ldap.rst @@ -473,7 +473,7 @@ In new Nextcloud installations the home folder rule is enforced. This means that In migrated Nextcloud installations the old behavior still applies, which is using the Nextcloud username as the home folder when an LDAP attribute is not set. You may change this enforcing the home folder rule with the ``occ`` command in Nextcloud, like this example on Ubuntu:: - sudo -u www-data php occ config:app:set user_ldap enforce_home_folder_naming_rule --value=1 + sudo -E -u www-data php occ config:app:set user_ldap enforce_home_folder_naming_rule --value=1 .. _LDAP_User_Profile_Attributes: @@ -494,7 +494,7 @@ Please be aware: - Having misformatted data in LDAP will most probably leave you with empty user profile fields - Setting the global ``profile.enabled => false`` on ``config.php`` skips the code -By calling ``php occ ldap:check-user --update `` the users data from LDAP will be displayed and the profile gets updated. To get the correct ```` value for any user you can use ``php occ user:list``. +By calling ``sudo -E -u www-data php occ ldap:check-user --update `` the users data from LDAP will be displayed and the profile gets updated. To get the correct ```` value for any user you can use ``php occ user:list``. .. note:: After unsetting an attribute name here, the data won't be deleted from user profile. Setting an nonexisting attribute will empty the corresponding profile field. @@ -662,7 +662,7 @@ It is not a per-configuration option. The value can be modified by:: - sudo -u www-data php occ config:app:set user_ldap updateAttributesInterval --value=86400 + sudo -E -u www-data php occ config:app:set user_ldap updateAttributesInterval --value=86400 A value of 0 will update it on every of the named occasions. @@ -678,7 +678,7 @@ search against. When a search is executed an exact match is required. Example usage:: - $ php occ ldap:promote-group --help + $ sudo -E -u www-data php occ ldap:promote-group --help Description: declares the specified group as admin group (only one is possible per LDAP configuration) @@ -693,15 +693,15 @@ Example usage:: … # Example - $ php occ ldap:promote-group "Nextcloud Admins" + $ sudo -E -u www-data php occ ldap:promote-group "Nextcloud Admins" Promote Nextcloud Admins to the admin group (y|N)? y Group Nextcloud Admins was promoted - $ php occ ldap:promote-group "Paramount Court" + $ sudo -E -u www-data php occ ldap:promote-group "Paramount Court" Promote Nextcloud Admins to the admin group and demote Nextcloud Admins (Group ID: nextcloud_admins) (y|N)? y Group Paramount Court was promoted - $ php occ ldap:promote-group "Paramount Court" + $ sudo -E -u www-data php occ ldap:promote-group "Paramount Court" The specified group is already promoted .. note:: Note the group ID will only be displayed when it differs from the diff --git a/admin_manual/configuration_user/user_auth_ldap_cleanup.rst b/admin_manual/configuration_user/user_auth_ldap_cleanup.rst index 23c09e292..a80898da1 100644 --- a/admin_manual/configuration_user/user_auth_ldap_cleanup.rst +++ b/admin_manual/configuration_user/user_auth_ldap_cleanup.rst @@ -36,7 +36,7 @@ minutes later the next 50, and so on. The amount of users to check can be set to a custom value via occ command. The following example sets it to 300: -``sudo -u www-data php occ config:app:set --value=300 user_ldap cleanUpJobChunkSize`` +``sudo -E -u www-data php occ config:app:set --value=300 user_ldap cleanUpJobChunkSize`` There are two ``occ`` commands to use for examining a table of users marked as deleted, and then manually deleting them. The ``occ`` command is in your @@ -46,15 +46,15 @@ your HTTP user. To learn more about ``occ``, see These examples are for Ubuntu Linux: -1. ``sudo -u www-data php occ ldap:show-remnants`` displays a table with all +1. ``sudo -E -u www-data php occ ldap:show-remnants`` displays a table with all users that have been marked as deleted, and their LDAP data. -2. ``sudo -u www-data php occ user:delete [user]`` removes the user's data from the +2. ``sudo -E -u www-data php occ user:delete [user]`` removes the user's data from the Nextcloud data directory. This example shows what the table of users marked as ``deleted`` looks like:: - $ sudo -u www-data php occ ldap:show-remnants + $ sudo -E -u www-data php occ ldap:show-remnants +-----------------+-----------------+------------------+--------------------------------------+ | Nextcloud name | Display Name | LDAP UID | LDAP DN | +-----------------+-----------------+------------------+--------------------------------------+ @@ -70,7 +70,7 @@ Following flags can be specified additionally: * ``--json``: instead of a table, the output is json-encoded. This makes it easy to process the data programmatically. -Then you can run ``sudo -u www-data php occ user:delete aaliyah_brown`` to delete +Then you can run ``sudo -E -u www-data php occ user:delete aaliyah_brown`` to delete user aaliyah_brown. You must use the user's Nextcloud name. Deleting local Nextcloud users diff --git a/admin_manual/groupware/calendar.rst b/admin_manual/groupware/calendar.rst index 1ff83a7c4..821aa79d4 100644 --- a/admin_manual/groupware/calendar.rst +++ b/admin_manual/groupware/calendar.rst @@ -30,7 +30,7 @@ Hide export buttons By default users can export their calendar data from the editor and the sidebar. Admins can disable this feature:: - php occ config:app:set calendar hideEventExport --value=yes + sudo -E -u www-data php occ config:app:set calendar hideEventExport --value=yes Invitations ----------- @@ -71,7 +71,7 @@ See :doc:`../occ_command` section Dav commands. You'll also need to change the sending mode from ``background-job`` to ``occ``:: - php occ config:app:set dav sendEventRemindersMode --value occ + sudo -E -u www-data php occ config:app:set dav sendEventRemindersMode --value occ If you don't use this dedicated command, the reminders will just be sent as soon as possible when the background jobs run. @@ -92,7 +92,7 @@ FreeBusy When logged-in, Nextcloud can return FreeBusy information for all users of the instance, to know when they are available so that you can schedule an event at the right time. If you don't wish for users to have this capability, you can disable FreeBusy for the whole instance with the following setting:: - php occ config:app:set dav disableFreeBusy --value yes + sudo -E -u www-data php occ config:app:set dav disableFreeBusy --value yes Subscriptions ------------- @@ -103,7 +103,7 @@ Custom public calendars In addition to the public holiday calendars, it is possible to define your own calendar. They act in the same way as the holiday calendars and can be configured with the following command:: - php occ config:app:set calendar publicCalendars --value '[{"name":"My custom calendar","source":"http://example.com/example.ics"}]' + sudo -E -u www-data php occ config:app:set calendar publicCalendars --value '[{"name":"My custom calendar","source":"http://example.com/example.ics"}]' The setting is specified as a JSON array of objects with the following options: @@ -122,7 +122,7 @@ Otherwise the default refresh rate is one day. To set up a different default refresh rate for calendars without server side refresh rates, change the ``calendarSubscriptionRefreshRate`` option:: - php occ config:app:set dav calendarSubscriptionRefreshRate --value "PT6H" + sudo -E -u www-data php occ config:app:set dav calendarSubscriptionRefreshRate --value "PT6H" Where the value is a `DateInterval `_, for instance with the above command all of the Nextcloud instance's calendars would be refreshed every 6 hours. @@ -132,7 +132,7 @@ Allow subscriptions on local network Because of security issues, Nextcloud forbids subscriptions from local network hosts. If you need to allow this, change the following parameter to:: - php occ config:app:set dav webcalAllowLocalAccess --value yes + sudo -E -u www-data php occ config:app:set dav webcalAllowLocalAccess --value yes Trash bin --------- @@ -143,7 +143,7 @@ The default delay before objects are purged from the trash bin is 30 days. A bac To set up a different retention period, change the ``calendarRetentionObligation`` option:: - php occ config:app:set dav calendarRetentionObligation --value=2592000 + sudo -E -u www-data php occ config:app:set dav calendarRetentionObligation --value=2592000 Where the value is the number of seconds for the period. Setting the value to ``0`` disables the trash bin. @@ -167,15 +167,15 @@ Rate limits Nextcloud rate limits the creation of calendars and subscriptions if too many items are created within a short time frame. The default is 10 calendars or subscriptions per hour. This can be customized as follows:: # Set limit to 15 items per 30 minutes - php occ config:app:set dav rateLimitCalendarCreation --type=integer --value=15 - php occ config:app:set dav rateLimitPeriodCalendarCreation --type=integer --value=1800 + sudo -E -u www-data php occ config:app:set dav rateLimitCalendarCreation --type=integer --value=15 + sudo -E -u www-data php occ config:app:set dav rateLimitPeriodCalendarCreation --type=integer --value=1800 Additionally, the maximum number of calendars and subscriptions a user may create is limited to 30 items. This can be customized too:: # Allow users to create 50 calendars/subscriptions - php occ config:app:set dav maximumCalendarsSubscriptions --type=integer --value=50 + sudo -E -u www-data php occ config:app:set dav maximumCalendarsSubscriptions --type=integer --value=50 or:: # Allow users to create calendars/subscriptions without restriction - php occ config:app:set dav maximumCalendarsSubscriptions --type=integer --value=-1 + sudo -E -u www-data php occ config:app:set dav maximumCalendarsSubscriptions --type=integer --value=-1 diff --git a/admin_manual/groupware/contacts.rst b/admin_manual/groupware/contacts.rst index 47556cd6b..41126100d 100644 --- a/admin_manual/groupware/contacts.rst +++ b/admin_manual/groupware/contacts.rst @@ -67,18 +67,18 @@ Rate limits Nextcloud rate limits the creation of address books and how many can be created in a short period of time. The default is 10 address books per hour. This can be customized as follows:: # Set limit to 15 items per 30 minutes - php occ config:app:set dav rateLimitAddressBookCreation --type=integer --value=15 - php occ config:app:set dav rateLimitPeriodAddressBookCreation --type=integer --value=1800 + sudo -E -u www-data php occ config:app:set dav rateLimitAddressBookCreation --type=integer --value=15 + sudo -E -u www-data php occ config:app:set dav rateLimitPeriodAddressBookCreation --type=integer --value=1800 Additionally, the maximum number of address books a user may create is limited to 10 items. This can be customized too:: # Allow users to create 50 addressbooks - php occ config:app:set dav maximumAdressbooks --type=integer --value=50 + sudo -E -u www-data php occ config:app:set dav maximumAdressbooks --type=integer --value=50 or:: # Allow users to create address books without restriction - php occ config:app:set dav maximumAdressbooks --type=integer --value=-1 + sudo -E -u www-data php occ config:app:set dav maximumAdressbooks --type=integer --value=-1 Example contact --------------- diff --git a/admin_manual/installation/command_line_installation.rst b/admin_manual/installation/command_line_installation.rst index 370fbc7fe..00ab3a9a4 100644 --- a/admin_manual/installation/command_line_installation.rst +++ b/admin_manual/installation/command_line_installation.rst @@ -19,7 +19,7 @@ this example for Debian/Ubuntu. You must run ``occ`` as your HTTP user; see of running the graphical Installation Wizard:: $ cd /var/www/nextcloud/ - $ sudo -u www-data php occ maintenance:install \ + $ sudo -E -u www-data php occ maintenance:install \ --database='mysql' --database-name='nextcloud' \ --database-user='root' --database-pass='password' \ --admin-user='admin' --admin-pass='password' diff --git a/admin_manual/installation/php_configuration.rst b/admin_manual/installation/php_configuration.rst index 3171bc9c2..8524bc745 100644 --- a/admin_manual/installation/php_configuration.rst +++ b/admin_manual/installation/php_configuration.rst @@ -89,7 +89,7 @@ For command line processing (*optional*): For command line updater (*optional*): -* PHP module phar (upgrades Nextcloud by running ``sudo -u www-data php /var/www/nextcloud/updater/updater.phar``) +* PHP module phar (upgrades Nextcloud by running ``sudo -E -u www-data php /var/www/nextcloud/updater/updater.phar``) ini values ---------- diff --git a/admin_manual/installation/source_installation.rst b/admin_manual/installation/source_installation.rst index 96b8f441e..291df183a 100644 --- a/admin_manual/installation/source_installation.rst +++ b/admin_manual/installation/source_installation.rst @@ -175,7 +175,7 @@ if your setup is available on ``https://example.org/nextcloud`` or:: if it isn't installed in a subfolder. Finally run this occ-command to update your .htaccess file:: - sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess + sudo -E -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess After each update, these changes are automatically applied to the ``.htaccess``-file. diff --git a/admin_manual/issues/applying_patch.rst b/admin_manual/issues/applying_patch.rst index 73662a762..93cae94b1 100644 --- a/admin_manual/issues/applying_patch.rst +++ b/admin_manual/issues/applying_patch.rst @@ -20,7 +20,7 @@ Patching server Patching apps ^^^^^^^^^^^^^ -1. Navigate to the root of this app (mostly ``apps/[APPID]/``), if you can not find the app there use the ``sudo -u www-data php occ app:getpath APPID`` command to find the path. +1. Navigate to the root of this app (mostly ``apps/[APPID]/``), if you can not find the app there use the ``sudo -E -u www-data php occ app:getpath APPID`` command to find the path. 2. Now apply the patch with the same command as in `Patching server`_ Reverting a patch diff --git a/admin_manual/issues/general_troubleshooting.rst b/admin_manual/issues/general_troubleshooting.rst index c6658bf09..cb44a279b 100644 --- a/admin_manual/issues/general_troubleshooting.rst +++ b/admin_manual/issues/general_troubleshooting.rst @@ -353,7 +353,7 @@ appear in the file listing, or they will appear and not be accessible. When this happens, please run the :ref:`files scanner`, for example with:: - sudo -u www-data php occ files:scan --all + sudo -E -u www-data php occ files:scan --all If the scanner tells about an encoding issue on the affected file, please enable Mac encoding compatibility in the :ref:`mount options` and then :ref:`rescan the external storage`. @@ -437,7 +437,7 @@ does not match the actual data stored in the user's ``data/$userId/files`` direc Running the following command can help fix the sizes and quota for a given user:: - sudo -u www-data php occ files:scan -vvv + sudo -E -u www-data php occ files:scan -vvv If **encryption was enabled earlier on the instance and disabled later on**, it is likely that some size values in the database did not correctly get reset upon decrypting. @@ -488,7 +488,7 @@ Encryption key cannot be found with external storage or group folders To resolve this issue, please run the following command:: - sudo -u www-data php occ encryption:fix-key-location + sudo -E -u www-data php occ encryption:fix-key-location This will attempt to recover keys that were not moved properly. diff --git a/admin_manual/maintenance/backup.rst b/admin_manual/maintenance/backup.rst index ee113a147..275f5b976 100644 --- a/admin_manual/maintenance/backup.rst +++ b/admin_manual/maintenance/backup.rst @@ -14,7 +14,7 @@ Maintenance mode ``maintenance:mode`` locks the sessions of logged-in users and prevents new logins in order to prevent inconsistencies of your data. You must run ``occ`` as the HTTP user, like this example on Ubuntu Linux:: - $ sudo -u www-data php occ maintenance:mode --on + $ sudo -E -u www-data php occ maintenance:mode --on You may also put your server into this mode by editing :file:`config/config.php`. Change ``"maintenance" => false`` to ``"maintenance" => true``: diff --git a/admin_manual/maintenance/manual_upgrade.rst b/admin_manual/maintenance/manual_upgrade.rst index 4a99bca44..80193a3b6 100644 --- a/admin_manual/maintenance/manual_upgrade.rst +++ b/admin_manual/maintenance/manual_upgrade.rst @@ -102,7 +102,7 @@ Step-by-Step Manual Upgrade 15. Now launch the upgrade from the command line using ``occ``, like this example on Ubuntu Linux:: - sudo -u www-data php occ upgrade + sudo -E -u www-data php occ upgrade (!) this MUST be executed from within your nextcloud installation directory @@ -133,7 +133,7 @@ Troubleshooting Occasionally, *files do not show up after a upgrade*. A rescan of the files can help:: - sudo -u www-data php console.php files:scan --all + sudo -E -u www-data php console.php files:scan --all See `the nextcloud.com support page `_ for further resources. @@ -142,15 +142,15 @@ Sometimes, Nextcloud can get *stuck in a upgrade* if the web based upgrade process is used. This is usually due to the process taking too long and encountering a PHP time-out. Stop the upgrade process this way:: - sudo -u www-data php occ maintenance:mode --off + sudo -E -u www-data php occ maintenance:mode --off Then start the manual process:: - sudo -u www-data php occ upgrade + sudo -E -u www-data php occ upgrade If this does not work properly, try the repair function:: - sudo -u www-data php occ maintenance:repair + sudo -E -u www-data php occ maintenance:repair .. _nextcloud.com/install/: diff --git a/admin_manual/maintenance/update.rst b/admin_manual/maintenance/update.rst index cb5bc215c..4f7fe6b33 100644 --- a/admin_manual/maintenance/update.rst +++ b/admin_manual/maintenance/update.rst @@ -135,7 +135,7 @@ This is how the command line based update would continue: .. code:: - $ sudo -u www-data php ./occ upgrade + $ sudo -E -u www-data php ./occ upgrade Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Set log level to debug @@ -176,7 +176,7 @@ The steps are basically the same as for the web based updater: 2. Instead of clicking that button you can now invoke the command line based updater by going into the `updater/` directory in the Nextcloud directory and executing the `updater.phar` as the web server user. (i.e. - ``sudo -u www-data php /var/www/nextcloud/updater/updater.phar``) + ``sudo -E -u www-data php /var/www/nextcloud/updater/updater.phar``) .. image:: images/updater-cli-2-start-updater.png :class: terminal-image @@ -223,7 +223,7 @@ except an error occurred during the ``occ upgrade`` or the replacement of the code. To execute this, run the command with the ``--no-interaction`` option. (i.e. -``sudo -u www-data php /var/www/nextcloud/updater/updater.phar --no-interaction``) +``sudo -E -u www-data php /var/www/nextcloud/updater/updater.phar --no-interaction``) .. image:: images/updater-cli-8-no-interaction.png :class: terminal-image diff --git a/admin_manual/maintenance/upgrade.rst b/admin_manual/maintenance/upgrade.rst index 39c4e38b2..847ba7f55 100644 --- a/admin_manual/maintenance/upgrade.rst +++ b/admin_manual/maintenance/upgrade.rst @@ -50,7 +50,7 @@ Nextcloud must be upgraded step by step: as a background job. If you plan to upgrade directly to another major version (e.g. 24 -> 25 -> 26) you need to make sure these migrations were executed before starting the next upgrade. To do so you should run the ``cron.php`` file 2-3 times, for example:: - $ sudo -u www-data php -f /var/www/nextcloud/cron.php + $ sudo -E -u www-data php -f /var/www/nextcloud/cron.php For more information about background jobs see :doc:`../configuration_server/background_jobs_configuration`. @@ -113,7 +113,7 @@ existing Nextcloud code with the code of the new Nextcloud version. logins. This is the mode to use for upgrades. You must run ``occ`` as the HTTP user, like this example on Ubuntu Linux:: - $ sudo -u www-data php occ maintenance:mode --on + $ sudo -E -u www-data php occ maintenance:mode --on You may also put your server into this mode by editing :file:`config/config.php`. Change ``"maintenance" => false`` to ``"maintenance" => true``: @@ -145,8 +145,8 @@ There is also always an hint in the setup checks of the admin settings web inter Those include for example:: - $ sudo -u www-data php occ db:add-missing-columns - $ sudo -u www-data php occ db:add-missing-indices - $ sudo -u www-data php occ db:add-missing-primary-keys + $ sudo -E -u www-data php occ db:add-missing-columns + $ sudo -E -u www-data php occ db:add-missing-indices + $ sudo -E -u www-data php occ db:add-missing-primary-keys You can use the ``--dry-run`` option to output the SQL queries instead of executing them. diff --git a/admin_manual/occ_command.rst b/admin_manual/occ_command.rst index f43de9607..36d96e3aa 100644 --- a/admin_manual/occ_command.rst +++ b/admin_manual/occ_command.rst @@ -75,7 +75,7 @@ example, in CentOS 6.5 with SCL-PHP70 installed, the command looks like this:: Running ``occ`` with no options lists all commands and options, like this example on Ubuntu:: - sudo -u www-data php occ + sudo -E -u www-data php occ Nextcloud version 19.0.0 Usage: @@ -102,20 +102,20 @@ example on Ubuntu:: a new release. The release has to be installed before. -This is the same as ``sudo -u www-data php occ list``. +This is the same as ``sudo -E -u www-data php occ list``. Run it with the ``-h`` option for syntax help:: - sudo -u www-data php occ -h + sudo -E -u www-data php occ -h Display your Nextcloud version:: - sudo -u www-data php occ -V + sudo -E -u www-data php occ -V Nextcloud version 19.0.0 Query your Nextcloud server status:: - sudo -u www-data php occ status + sudo -E -u www-data php occ status - installed: true - version: 19.0.0.12 - versionstring: 19.0.0 @@ -129,7 +129,7 @@ optional, while commands are required. The syntax is:: Get detailed information on individual commands with the ``help`` command, like this example for the ``maintenance:mode`` command:: - sudo -u www-data php occ help maintenance:mode + sudo -E -u www-data php occ help maintenance:mode Usage: maintenance:mode [options] @@ -149,12 +149,12 @@ this example for the ``maintenance:mode`` command:: The ``status`` command from above has an option to define the output format. The default is plain text, but it can also be ``json``:: - sudo -u www-data php occ status --output=json + sudo -E -u www-data php occ status --output=json {"installed":true,"version":"19.0.0.9","versionstring":"19.0.0","edition":""} or ``json_pretty``:: - sudo -u www-data php occ status --output=json_pretty + sudo -E -u www-data php occ status --output=json_pretty { "installed": true, "version": "19.0.0.12", @@ -171,7 +171,7 @@ Environment variables ``sudo`` does not forward environment variables by default. Put the variables before the ``php`` command:: - sudo -u www-data NC_debug=true php occ status + NC_debug=true sudo -E -u www-data php occ status Alternatively, you can ``export`` the variable or use the ``-E`` switch for ``sudo``:: @@ -235,83 +235,83 @@ The ``app`` commands list, enable, and disable apps:: Download and install an app:: - sudo -u www-data php occ app:install twofactor_totp + sudo -E -u www-data php occ app:install twofactor_totp Install but don't enable:: - sudo -u www-data php occ app:install --keep-disabled twofactor_totp + sudo -E -u www-data php occ app:install --keep-disabled twofactor_totp Install regardless of the Nextcloud version requirement:: - sudo -u www-data php occ app:install --force twofactor_totp + sudo -E -u www-data php occ app:install --force twofactor_totp List all of your installed apps, and show whether they are enabled or disabled:: - sudo -u www-data php occ app:list + sudo -E -u www-data php occ app:list List non-shipped installed apps only:: - sudo -u www-data php occ app:list --shipped false + sudo -E -u www-data php occ app:list --shipped false Enable an app, for example the External Storage Support app:: - sudo -u www-data php occ app:enable files_external + sudo -E -u www-data php occ app:enable files_external files_external enabled Enable an app regardless of the Nextcloud version requirement:: - sudo -u www-data php occ app:enable --force files_external + sudo -E -u www-data php occ app:enable --force files_external files_external enabled Enable an app for specific groups of users:: - sudo -u www-data php occ app:enable --groups admin --groups sales files_external + sudo -E -u www-data php occ app:enable --groups admin --groups sales files_external files_external enabled for groups: admin, sales Enable multiple apps simultaneously:: - sudo -u www-data php occ app:enable app1 app2 app3 + sudo -E -u www-data php occ app:enable app1 app2 app3 app1 enabled app2 enabled app3 enabled Disable an app:: - sudo -u www-data php occ app:disable files_external + sudo -E -u www-data php occ app:disable files_external files_external disabled Disable and remove an app:: - sudo -u www-data php occ app:remove files_external + sudo -E -u www-data php occ app:remove files_external files_external disabled files_external 1.21.0 removed Remove an app, but keep the app data:: - sudo -u www-data php occ app:remove --keep-data files_external + sudo -E -u www-data php occ app:remove --keep-data files_external files_external 1.21.0 removed You can get the full filepath to an app:: - sudo -u www-data php occ app:getpath notifications + sudo -E -u www-data php occ app:getpath notifications /var/www/nextcloud/apps/notifications To update an app, for instance Contacts:: - sudo -u www-data php occ app:update contacts + sudo -E -u www-data php occ app:update contacts To update all apps:: - sudo -u www-data php occ app:update --all + sudo -E -u www-data php occ app:update --all To show available update(s) without updating:: - sudo -u www-data php occ app:update --showonly + sudo -E -u www-data php occ app:update --showonly To update an app to an unstable release, for instance News:: - sudo -u www-data php occ app:update --allow-unstable news + sudo -E -u www-data php occ app:update --allow-unstable news .. _background_jobs_selector_label: @@ -329,7 +329,7 @@ the **Cron** section on your Nextcloud Admin page:: This example selects Ajax:: - sudo -u www-data php occ background:ajax + sudo -E -u www-data php occ background:ajax Set mode for background jobs to 'ajax' The other two commands are: @@ -374,25 +374,25 @@ While setting a configuration value, multiple options are available: You can list all configuration values with one command:: - sudo -u www-data php occ config:list + sudo -E -u www-data php occ config:list By default, passwords and other sensitive data are omitted from the report, so the output can be posted publicly (e.g. as part of a bug report). In order to generate a full backport of all configuration values the ``--private`` flag needs to be set:: - sudo -u www-data php occ config:list --private + sudo -E -u www-data php occ config:list --private The exported content can also be imported again to allow the fast setup of similar instances. The import command will only add or update values. Values that exist in the current configuration, but not in the one that is being imported are left untouched:: - sudo -u www-data php occ config:import filename.json + sudo -E -u www-data php occ config:import filename.json It is also possible to import remote files, by piping the input:: - sudo -u www-data php occ config:import < local-backup.json + sudo -E -u www-data php occ config:import < local-backup.json .. note:: @@ -406,10 +406,10 @@ Getting a single configuration value These commands get the value of a single app or system configuration:: - sudo -u www-data php occ config:system:get version + sudo -E -u www-data php occ config:system:get version 19.0.0.12 - sudo -u www-data php occ config:app:get activity installed_version + sudo -E -u www-data php occ config:app:get activity installed_version 2.2.1 Setting a single configuration value @@ -417,18 +417,18 @@ Setting a single configuration value These commands set the value of a single app or system configuration:: - sudo -u www-data php occ config:system:set logtimezone + sudo -E -u www-data php occ config:system:set logtimezone --value="Europe/Berlin" System config value logtimezone set to Europe/Berlin - sudo -u www-data php occ config:app:set files_sharing + sudo -E -u www-data php occ config:app:set files_sharing incoming_server2server_share_enabled --value="yes" Config value incoming_server2server_share_enabled for app files_sharing set to yes The ``config:system:set`` command creates the value, if it does not already exist. To update an existing value, set ``--update-only``:: - sudo -u www-data php occ config:system:set doesnotexist --value="true" + sudo -E -u www-data php occ config:system:set doesnotexist --value="true" --type=boolean --update-only Value not updated, as it has not been set before. @@ -444,7 +444,7 @@ known: When you want to e.g. disable the maintenance mode run the following command:: - sudo -u www-data php occ config:system:set maintenance --value=false + sudo -E -u www-data php occ config:system:set maintenance --value=false --type=boolean Nextcloud is in maintenance mode - no app have been loaded System config value maintenance set to boolean false @@ -455,7 +455,7 @@ Setting an array configuration value Some configurations (e.g. the trusted domain setting) are an array of data. In this case, ``config:system:get`` for this key will return multiple values:: - sudo -u www-data php occ config:system:get trusted_domains + sudo -E -u www-data php occ config:system:get trusted_domains localhost nextcloud.local sample.tld @@ -465,11 +465,11 @@ second ``name`` in the ``config:system:set`` command, separated by a space. For example, to replace ``sample.tld`` with ``example.com``, ``trusted_domains => 2`` needs to be set:: - sudo -u www-data php occ config:system:set trusted_domains 2 + sudo -E -u www-data php occ config:system:set trusted_domains 2 --value=example.com System config value trusted_domains => 2 set to string example.com - sudo -u www-data php occ config:system:get trusted_domains + sudo -E -u www-data php occ config:system:get trusted_domains localhost nextcloud.local example.com @@ -491,29 +491,29 @@ for the Redis cache would look like this in the ``config.php`` file:: Setting such hierarchical values works similarly to setting an array value above. For this Redis example, use the following commands:: - sudo -u www-data php occ config:system:set redis host \ + sudo -E -u www-data php occ config:system:set redis host \ --value=/var/run/redis/redis.sock - sudo -u www-data php occ config:system:set redis port --value=0 - sudo -u www-data php occ config:system:set redis dbindex --value=0 - sudo -u www-data php occ config:system:set redis password --value=secret - sudo -u www-data php occ config:system:set redis timeout --value=1.5 + sudo -E -u www-data php occ config:system:set redis port --value=0 + sudo -E -u www-data php occ config:system:set redis dbindex --value=0 + sudo -E -u www-data php occ config:system:set redis password --value=secret + sudo -E -u www-data php occ config:system:set redis timeout --value=1.5 Deleting a single configuration value ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ These commands delete the configuration of an app or system configuration:: - sudo -u www-data php occ config:system:delete maintenance:mode + sudo -E -u www-data php occ config:system:delete maintenance:mode System config value maintenance:mode deleted - sudo -u www-data php occ config:app:delete appname provisioning_api + sudo -E -u www-data php occ config:app:delete appname provisioning_api Config value provisioning_api of app appname deleted The delete command will by default not complain if the configuration was not set before. If you want to be notified in that case, set the ``--error-if-not-exists`` flag:: - sudo -u www-data php occ config:system:delete doesnotexist + sudo -E -u www-data php occ config:system:delete doesnotexist --error-if-not-exists Config provisioning_api of app appname could not be deleted because it did not exist @@ -553,7 +553,7 @@ List all addressbooks of a user This example will list all addressbooks for user annie: :: - sudo -u www-data php occ dav:list-addressbooks annie + sudo -E -u www-data php occ dav:list-addressbooks annie Create a addressbook for a user """"""""""""""""""""""""""""""" @@ -562,7 +562,7 @@ Create a addressbook for a user This example creates the addressbook ``mollybook`` for the user molly: :: - sudo -u www-data php occ dav:create-addressbook molly mollybook + sudo -E -u www-data php occ dav:create-addressbook molly mollybook Manage calendars @@ -575,7 +575,7 @@ List all calendars of a user This example will list all calendars for user annie: :: - sudo -u www-data php occ dav:list-calendars annie + sudo -E -u www-data php occ dav:list-calendars annie Create a calendar for a user """""""""""""""""""""""""""" @@ -585,7 +585,7 @@ Create a calendar for a user This example creates the calendar ``mollycal`` for the user molly: :: - sudo -u www-data php occ dav:create-calendar molly mollycal + sudo -E -u www-data php occ dav:create-calendar molly mollycal Delete a calendar for a user """""""""""""""""""""""""""" @@ -597,11 +597,11 @@ specified) of the user ``uid``. You can use the force option ``-f`` or This example will delete the calendar mollycal of user molly:: - sudo -u www-data php occ dav:delete-calendar molly mollycal + sudo -E -u www-data php occ dav:delete-calendar molly mollycal This example will delete the birthday calendar of user molly:: - sudo -u www-data php occ dav:delete-calendar --birthday molly + sudo -E -u www-data php occ dav:delete-calendar --birthday molly Move a calendar of a user @@ -614,7 +614,7 @@ Move a calendar of a user This example will move calendar named personal from user dennis to user sabine: :: - sudo -u www-data php occ dav:move-calendar personal dennis sabine + sudo -E -u www-data php occ dav:move-calendar personal dennis sabine Misc """" @@ -639,7 +639,7 @@ List all calendar subscriptions of a user This example will list all calendar subscriptions for user annie: :: - sudo -u www-data php occ dav:list-subscriptions annie + sudo -E -u www-data php occ dav:list-subscriptions annie Create a calendar subscription for a user @@ -649,11 +649,11 @@ Create a calendar subscription for a user This example creates the subscription for the lunar calendar ``Lunar Calendar`` for the user molly: :: - sudo -u www-data php occ dav:create-subscription molly "Lunar Calendar" webcal://cantonbecker.com/astronomy-calendar/astrocal.ics + sudo -E -u www-data php occ dav:create-subscription molly "Lunar Calendar" webcal://cantonbecker.com/astronomy-calendar/astrocal.ics Optionally, a color for the new subscription calendar can be passed as a HEX color code:: - sudo -u www-data php occ dav:create-subscription molly "Lunar Calendar" calendar webcal://cantonbecker.com/astronomy-calendar/astrocal.ics "#ff5733" + sudo -E -u www-data php occ dav:create-subscription molly "Lunar Calendar" calendar webcal://cantonbecker.com/astronomy-calendar/astrocal.ics "#ff5733" If not set, the theming default color will be used. @@ -665,7 +665,7 @@ Delete a calendar subscription for a user This example deletes the subscription for the lunar calendar ``Lunar Calendar`` for the user molly: :: - sudo -u www-data php occ dav:delete-subscription molly "Lunar Calendar" + sudo -E -u www-data php occ dav:delete-subscription molly "Lunar Calendar" .. _dav-sync-system-address-book: @@ -676,7 +676,7 @@ Sync system address book ``dav:sync-system-addressbook`` synchronizes all users to the :ref:`system address book`:: - sudo -u www-data php occ dav:sync-system-addressbook + sudo -E -u www-data php occ dav:sync-system-addressbook Sync birthday calendar ^^^^^^^^^^^^^^^^^^^^^^ @@ -684,7 +684,7 @@ Sync birthday calendar ``dav:sync-birthday-calendar []`` adds all birthdays to your calendar from addressbooks shared with you. This example syncs to your calendar from user bernie: :: - sudo -u www-data php occ dav:sync-birthday-calendar bernie + sudo -E -u www-data php occ dav:sync-birthday-calendar bernie .. _database_conversion_label: @@ -713,7 +713,7 @@ You need: This is example converts SQLite to MySQL/MariaDB:: - sudo -u www-data php occ db:convert-type mysql oc_dbuser 127.0.0.1 + sudo -E -u www-data php occ db:convert-type mysql oc_dbuser 127.0.0.1 oc_database For a more detailed explanation see @@ -728,7 +728,7 @@ It might happen that we add from time to time new indices to already existing da for example to improve performance. In order to check your database for missing indices run following command:: - sudo -u www-data php occ db:add-missing-indices + sudo -E -u www-data php occ db:add-missing-indices Use option ``--dry-run`` to output the SQL queries without running them. @@ -760,9 +760,9 @@ Encryption encryption module. To enable encryption you must first enable the Encryption app, and then run ``encryption:enable``:: - sudo -u www-data php occ app:enable encryption - sudo -u www-data php occ encryption:enable - sudo -u www-data php occ encryption:status + sudo -E -u www-data php occ app:enable encryption + sudo -E -u www-data php occ encryption:enable + sudo -E -u www-data php occ encryption:status - enabled: true - defaultModule: OC_DEFAULT_MODULE @@ -770,11 +770,11 @@ app, and then run ``encryption:enable``:: different folder. It takes one argument, ``newRoot``, which defines your new root folder:: - sudo -u www-data php occ encryption:change-key-storage-root /etc/oc-keys + sudo -E -u www-data php occ encryption:change-key-storage-root /etc/oc-keys You can see the current location of your keys folder:: - sudo -u www-data php occ encryption:show-key-storage-root + sudo -E -u www-data php occ encryption:show-key-storage-root Current key storage root: default storage location (data/) ``encryption:list-modules`` displays your available encryption modules. You will @@ -789,7 +789,7 @@ is completed. ``encryption:decrypt-all`` decrypts all user data files, or optionally a single user:: - sudo -u www-data php occ encryption:decrypt freda + sudo -E -u www-data php occ encryption:decrypt freda Users must have enabled recovery keys on their Personal pages. @@ -834,7 +834,7 @@ In Nextcloud, servers connected with federation shares can share user address books, and auto-complete usernames in share dialogs. Use this command to synchronize federated servers:: - sudo -u www-data php occ federation:sync-addressbooks + sudo -E -u www-data php occ federation:sync-addressbooks .. _file_operations_label: @@ -869,7 +869,7 @@ may rescan all files, per-user, a space-delimited list of users, and limit the search path. If not using ``--quiet``, statistics will be shown at the end of the scan:: - sudo -u www-data php occ files:scan --help + sudo -E -u www-data php occ files:scan --help Description: rescan filesystem @@ -994,7 +994,7 @@ The command ``occ files:transfer-ownership`` can be used to transfer files from You may transfer all files and shares from one user to another. This is useful before removing a user:: - sudo -u www-data php occ files:transfer-ownership + sudo -E -u www-data php occ files:transfer-ownership The transferred files will appear inside a new sub-directory in the destination user's home. @@ -1003,25 +1003,25 @@ The transferred files will appear inside a new sub-directory in the destination If the destination user has no files at all (empty home), it is possible to also transfer all the source user's files by passing ``--move``:: - sudo -u www-data php occ files:transfer-ownership --move + sudo -E -u www-data php occ files:transfer-ownership --move In this case no sub-directory is created and all files will appear directly in the root of the user's home. It is also possible to transfer only one directory along with its contents. This can be useful to restructure your organization or quotas. The ``--path`` argument is given as the path to the directory as seen from the source user:: - sudo -u www-data php occ files:transfer-ownership --path="path_to_dir" + sudo -E -u www-data php occ files:transfer-ownership --path="path_to_dir" Incoming shares are not moved by default because the sharing user holds the ownership of the respective files. There is however an option to enable moving incoming shares. In case the incoming shares must be transferred as well, use the argument ``--transfer-incoming-shares`` with ``0`` or ``1`` as parameters :: - sudo -u www-data php occ files:transfer-ownership --transfer-incoming-shares=1 --path="path_to_dir" + sudo -E -u www-data php occ files:transfer-ownership --transfer-incoming-shares=1 --path="path_to_dir" As an alternative, the system configuration option ``transferIncomingShares`` in config.php can be set to ``true`` to always transfer incoming shares. The command line option ``--transfer-incoming-shares`` overwrites the config.php option ``transferIncomingShares``. For example, ``'transferIncomingShares => true`` can be overwritten by: :: - sudo -u www-data php occ files:transfer-ownership --transfer-incoming-shares=0 + sudo -E -u www-data php occ files:transfer-ownership --transfer-incoming-shares=0 Users may also transfer files or folders selectively by themselves. See `user documentation `_ for details. @@ -1094,11 +1094,11 @@ Apps which have a ``Featured`` tag MUST be code signed with Nextcloud. Unsigned After creating your signing key, sign your app like this example:: - sudo -u www-data php occ integrity:sign-app --privateKey=/Users/lukasreschke/contacts.key --certificate=/Users/lukasreschke/CA/contacts.crt --path=/Users/lukasreschke/Programming/contacts + sudo -E -u www-data php occ integrity:sign-app --privateKey=/Users/lukasreschke/contacts.key --certificate=/Users/lukasreschke/CA/contacts.crt --path=/Users/lukasreschke/Programming/contacts Verify your app:: - sudo -u www-data php occ integrity:check-app --path=/pathto/app appname + sudo -E -u www-data php occ integrity:check-app --path=/pathto/app appname When it returns nothing, your app is signed correctly. When it returns a message then there is an error. See `Code Signing `_ in the Developer manual for more detailed information. @@ -1149,18 +1149,18 @@ ldap\:search Search for an LDAP user, using this syntax - sudo -u www-data php occ ldap:search [--group] [--offset="..."] + sudo -E -u www-data php occ ldap:search [--group] [--offset="..."] [--limit="..."] search Searches will match at the beginning of the attribute value only. This example searches for givenNames that start with "rob":: - sudo -u www-data php occ ldap:search "rob" + sudo -E -u www-data php occ ldap:search "rob" This will find robbie, roberta, and robin. Broaden the search to find, for example, ``jeroboam`` with the asterisk wildcard:: - sudo -u www-data php occ ldap:search "*rob" + sudo -E -u www-data php occ ldap:search "*rob" User search attributes are set with ``ldap:set-config`` (below). For example, if your search attributes are @@ -1171,7 +1171,7 @@ Trailing whitespaces are ignored. Check if an LDAP user exists. This works only if the Nextcloud server is connected to an LDAP server:: - sudo -u www-data php occ ldap:check-user robert + sudo -E -u www-data php occ ldap:check-user robert ldap\:check-user ^^^^^^^^^^^^^^^^ @@ -1182,7 +1182,7 @@ being marked as deleted. If you know for certain that the user you are searching is not in one of the disabled connections, and exists on an active connection, use the ``--force`` option to force it to check all active LDAP connections:: - sudo -u www-data php occ ldap:check-user --force robert + sudo -E -u www-data php occ ldap:check-user --force robert ldap\:check-group ^^^^^^^^^^^^^^^^^ @@ -1190,7 +1190,7 @@ ldap\:check-group Checks whether a group still exists in the LDAP directory. Use with ``--update`` to update the group membership cache on the Nextcloud side:: - sudo -u www-data php occ ldap:check-group --update mygroup + sudo -E -u www-data php occ ldap:check-group --update mygroup ldap\:create-empty-config ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1199,23 +1199,23 @@ Creates an empty LDAP configuration. The first one you create has ``configID`` ``s01``, and all subsequent configurations that you create are automatically assigned IDs:: - sudo -u www-data php occ ldap:create-empty-config + sudo -E -u www-data php occ ldap:create-empty-config Created new configuration with configID 's01' Then you can list and view your configurations:: - sudo -u www-data php occ ldap:show-config + sudo -E -u www-data php occ ldap:show-config And view the configuration for a single configID:: - sudo -u www-data php occ ldap:show-config s01 + sudo -E -u www-data php occ ldap:show-config s01 ldap\:delete-config ^^^^^^^^^^^^^^^^^^^ Deletes an existing LDAP configuration:: - sudo -u www-data php occ ldap:delete s01 + sudo -E -u www-data php occ ldap:delete s01 Deleted configuration with configID 's01' ldap\:set-config @@ -1224,7 +1224,7 @@ ldap\:set-config This command is for manipulating configurations, like this example that sets search attributes:: - sudo -u www-data php occ ldap:set-config s01 ldapAttributesForUserSearch + sudo -E -u www-data php occ ldap:set-config s01 ldapAttributesForUserSearch "cn;givenname;sn;displayname;mail" ldap\:test-config @@ -1233,7 +1233,7 @@ ldap\:test-config Tests whether your configuration is correct and can bind to the server:: - sudo -u www-data php occ ldap:test-config s01 + sudo -E -u www-data php occ ldap:test-config s01 The configuration is valid and the connection could be established! ldap\:test-user-settings @@ -1241,7 +1241,7 @@ ldap\:test-user-settings Tests user-related LDAP settings:: - sudo -u www-data php occ ldap:test-user-settings "cn=philip j. fry,ou=people,dc=planetexpress,dc=com" --group "Everyone" + sudo -E -u www-data php occ ldap:test-user-settings "cn=philip j. fry,ou=people,dc=planetexpress,dc=com" --group "Everyone" User cn=philip j. fry,ou=people,dc=planetexpress,dc=com is mapped with account name fry. Known UUID is ce6cd914-71d5-103f-95a8-ad2dab17b2f9. @@ -1299,7 +1299,7 @@ These commands view and configure your Nextcloud logging preferences:: Run ``log:file [--] [--enable] [--file] [--rotate-size]`` to see your current logging status:: - sudo -u www-data php occ log:file + sudo -E -u www-data php occ log:file Log backend Nextcloud: enabled Log file: /opt/nextcloud/data/nextcloud.log Rotate at: disabled @@ -1339,8 +1339,8 @@ maintenance mode. Users who are not already logged in cannot log in until maintenance mode is turned off. When you take the server out of maintenance mode logged-in users must refresh their Web browsers to continue working:: - sudo -u www-data php occ maintenance:mode --on - sudo -u www-data php occ maintenance:mode --off + sudo -E -u www-data php occ maintenance:mode --on + sudo -E -u www-data php occ maintenance:mode --off After restoring a backup of your data directory or the database, you should always call ``maintenance:data-fingerprint`` once. This changes the ETag for all files @@ -1350,7 +1350,7 @@ The ``maintenance:repair`` command runs automatically during upgrades to clean up the database, so while you can run it manually there usually isn't a need to:: - sudo -u www-data php occ maintenance:repair + sudo -E -u www-data php occ maintenance:repair ``maintenance:mimetype:update-db`` updates the Nextcloud database and file cache with changed mimetypes found in ``config/mimetypemapping.json``. Run this @@ -1379,27 +1379,27 @@ creating federation connections with other Nextcloud servers that use self-signe Reset an IP:: - sudo -u www-data php occ security:bruteforce:reset [IP address] + sudo -E -u www-data php occ security:bruteforce:reset [IP address] This example lists your installed certificates:: - sudo -u www-data php occ security:certificates + sudo -E -u www-data php occ security:certificates Import a new certificate:: - sudo -u www-data php occ security:certificates:import /path/to/certificate + sudo -E -u www-data php occ security:certificates:import /path/to/certificate Remove a certificate:: - sudo -u www-data php occ security:certificates:remove [certificate name] + sudo -E -u www-data php occ security:certificates:remove [certificate name] Status ------ Use the status command to retrieve information about the current installation:: - $ sudo -u www-data php occ status + $ sudo -E -u www-data php occ status - installed: true - version: 25.0.2.3 - versionstring: 25.0.2 @@ -1411,7 +1411,7 @@ Use the status command to retrieve information about the current installation:: This information can also be formatted via JSON instead of plain text:: - $ php occ status --output=json_pretty + $ sudo -E -u www-data php occ status --output=json_pretty { "installed": true, "version": "25.0.2.3", @@ -1429,17 +1429,17 @@ Status return code And finally, the ``-e`` (for exit code) parameter can be used to check the state of the nextcloud installation via return code:: - $ php occ status -e + $ sudo -E -u www-data php occ status -e $ echo $? 0 - $ php occ maintenance:mode --on + $ sudo -E -u www-data php occ maintenance:mode --on Maintenance mode enabled - $ php occ status -e + $ sudo -E -u www-data php occ status -e $ echo $? 1 - $ php occ maintenance:mode --off + $ sudo -E -u www-data php occ maintenance:mode --off Maintenance mode disabled - $ php occ status -e + $ sudo -E -u www-data php occ status -e $ echo $? 0 @@ -1455,7 +1455,7 @@ units. | 1 | maintenance mode is enabled; the instance is currently | | | unavailable to users. | +-------------+--------------------------------------------------------+ -| 2 | ``php occ upgrade`` is required | +| 2 | ``sudo -E -u www-data php occ upgrade`` is required | +-------------+--------------------------------------------------------+ .. _trashbin_label: @@ -1480,7 +1480,7 @@ users in a space-delimited list, or all users if --all-users is specified. This example permanently removes the deleted files of all users:: - sudo -u www-data php occ trashbin:cleanup --all-users + sudo -E -u www-data php occ trashbin:cleanup --all-users Remove all deleted files for all users Remove deleted files for users on backend Database freda @@ -1491,7 +1491,7 @@ This example permanently removes the deleted files of all users:: This example permanently removes the deleted files of users molly and freda:: - sudo -u www-data php occ trashbin:cleanup molly freda + sudo -E -u www-data php occ trashbin:cleanup molly freda Remove deleted files of molly Remove deleted files of freda @@ -1500,25 +1500,25 @@ users in a space-delimited list, or all users if --all-users is specified. This example restores the deleted user-files of all users:: - sudo -u www-data php occ trashbin:restore --all-users + sudo -E -u www-data php occ trashbin:restore --all-users This example restores the deleted user-files of users molly and freda:: - sudo -u www-data php occ trashbin:restore molly freda + sudo -E -u www-data php occ trashbin:restore molly freda The ``--scope`` option can be used to limit the restore to a specific scope. Possible values are "user", "groupfolders" or "all" [default: "user"]. This example restores the deleted files of all groupfolders which are visible to the user freda:: - sudo -u www-data php occ trashbin:restore --scope groupfolders freda + sudo -E -u www-data php occ trashbin:restore --scope groupfolders freda The ``--since`` and ``--until`` options can be used to limit the restore to files deleted inside of the given time period. This example restores the locally deleted files and files of any groupfolders which are visible to the user freda. Additionally the files have to be deleted between ``01.08.2023 11:55:22`` and ``02.08.2023 01:33``:: - sudo -u www-data php occ trashbin:restore --scope all --since "01.08.2023 11:55:22" --until "02.08.2023 01:33" freda + sudo -E -u www-data php occ trashbin:restore --scope all --since "01.08.2023 11:55:22" --until "02.08.2023 01:33" freda The ``--dry-run`` option can be used to simulate the restore without actually restoring the files. @@ -1568,7 +1568,7 @@ Nextcloud Web UI, and the ``uid`` is their **Username**, which is their login name. This example adds new user Layla Smith, and adds them to the **users** and **db-admins** groups. Any groups that do not exist are created:: - sudo -u www-data php occ user:add --display-name="Layla Smith" + sudo -E -u www-data php occ user:add --display-name="Layla Smith" --group="users" --group="db-admins" layla Enter password: Confirm password: @@ -1590,8 +1590,7 @@ because ``sudo`` strips environment variables. This example adds new user Fred Jones:: export OC_PASS=newpassword - su -s /bin/sh www-data -c 'php occ user:add --password-from-env - --display-name="Fred Jones" --group="users" fred' + sudo -E -u www-data php occ user:add --password-from-env --display-name="Fred Jones" --group="users" fred The user "fred" was created successfully Display name set to "Fred Jones" User "fred" added to group "users" @@ -1602,7 +1601,7 @@ passwords. This can be used in conjunction with the ``email`` option to create users with a temporary password and send a welcome email to the user's email address without user interaction:: - sudo -u www-data php occ user:add layla --generate-password --email layla@example.tld + sudo -E -u www-data php occ user:add layla --generate-password --email layla@example.tld The account "layla" was created successfully Welcome email sent to layla@example.tld @@ -1610,7 +1609,7 @@ The ``email`` option allows you to set the user's email address when creating the user. A welcome email will be sent to the user's email address if ``newUser.sendEmail`` is set to ``yes`` in ``core``'s app config or not set at all:: - sudo -u www-data php occ user:add layla --email layla@example.tld + sudo -E -u www-data php occ user:add layla --email layla@example.tld Enter password: Confirm password: The account "layla" was created successfully @@ -1622,7 +1621,7 @@ user:resetpassword You can reset any user's password, including administrators (see :doc:`../configuration_user/reset_admin_password`):: - sudo -u www-data php occ user:resetpassword layla + sudo -E -u www-data php occ user:resetpassword layla Enter a new password: Confirm the new password: Successfully reset password for layla @@ -1630,8 +1629,7 @@ You can reset any user's password, including administrators (see You may also use ``password-from-env`` to reset passwords:: export OC_PASS=newpassword - su -s /bin/sh www-data -c 'php occ user:resetpassword --password-from-env - layla' + sudo -E -u www-data php occ user:resetpassword --password-from-env layla Successfully reset password for layla user:delete @@ -1639,19 +1637,19 @@ user:delete You can delete users:: - sudo -u www-data php occ user:delete fred + sudo -E -u www-data php occ user:delete fred user:lastseen ^^^^^^^^^^^^^ View a specific user's most recent login:: - sudo -u www-data php occ user:lastseen layla + sudo -E -u www-data php occ user:lastseen layla layla's last login: 2024-03-20 17:18 View a list of all users' most recent login:: - sudo -u www-data php occ user:lastseen --all + sudo -E -u www-data php occ user:lastseen --all albert's last login: 2024-03-18 10:30 bob has never logged in. layla's last login: 2024-03-20 17:18 @@ -1662,7 +1660,7 @@ user:setting Read user settings:: - sudo -u www-data php occ user:setting layla + sudo -E -u www-data php occ user:setting layla - core: - lang: en - login: @@ -1672,22 +1670,22 @@ Read user settings:: Filter by app:: - sudo -u www-data php occ user:setting layla core + sudo -E -u www-data php occ user:setting layla core - core: - lang: en Get a single setting:: - sudo -u www-data php occ user:setting layla core lang + sudo -E -u www-data php occ user:setting layla core lang en Set a setting:: - sudo -u www-data php occ user:setting layla settings email "new-layla@example.tld" + sudo -E -u www-data php occ user:setting layla settings email "new-layla@example.tld" Delete a setting:: - sudo -u www-data php occ user:setting layla settings email --delete + sudo -E -u www-data php occ user:setting layla settings email --delete user:report ^^^^^^^^^^^ @@ -1695,7 +1693,7 @@ user:report Generate a simple report that counts all users, including users on external user authentication servers such as LDAP:: - sudo -u www-data php occ user:report + sudo -E -u www-data php occ user:report +------------------+----+ | User Report | | +------------------+----+ @@ -1772,7 +1770,7 @@ The ``gid`` corresponds to the group name you entering after clicking "Add group" on the Users page in your Nextcloud Web UI. This example adds new group "beer":: - sudo -u www-data php occ group:add beer + sudo -E -u www-data php occ group:add beer Add an existing user to the specified group with the ``group:adduser`` command. The syntax is:: @@ -1781,19 +1779,19 @@ command. The syntax is:: This example adds the user "denis" to the existing group "beer":: - sudo -u www-data php occ group:adduser beer denis + sudo -E -u www-data php occ group:adduser beer denis You can remove user from the group with the ``group:removeuser`` command. This example removes the existing user "denis" from the existing group "beer":: - sudo -u www-data php occ group:removeuser beer denis + sudo -E -u www-data php occ group:removeuser beer denis Remove a group with the ``group:delete`` command. Removing a group doesn't remove users in a group. You cannot remove the "admin" group. This example removes the existing group "beer":: - sudo -u www-data php occ group:delete beer + sudo -E -u www-data php occ group:delete beer List configured groups via the ``group:list`` command. The syntax is:: @@ -1825,7 +1823,7 @@ when none are specified:: This example deletes all versions for all users:: - sudo -u www-data php occ versions:cleanup + sudo -E -u www-data php occ versions:cleanup Delete all versions Delete versions for users on backend Database freda @@ -1836,7 +1834,7 @@ This example deletes all versions for all users:: You can delete versions for specific users in a space-delimited list:: - sudo -u www-data php occ versions:cleanup freda molly + sudo -E -u www-data php occ versions:cleanup freda molly Delete versions of freda Delete versions of molly @@ -1854,7 +1852,7 @@ commands in place of running the graphical Installation Wizard. Then choose your ``occ`` options. This lists your available options:: - sudo -u www-data php /var/www/nextcloud/occ + sudo -E -u www-data php /var/www/nextcloud/occ Nextcloud is not installed - only a limited number of commands are available Nextcloud version 19.0.0 @@ -1884,7 +1882,7 @@ Then choose your ``occ`` options. This lists your available options:: Display your ``maintenance:install`` options:: - sudo -u www-data php occ help maintenance:install + sudo -E -u www-data php occ help maintenance:install Nextcloud is not installed - only a limited number of commands are available Usage: maintenance:install [--database="..."] [--database-name="..."] @@ -1914,7 +1912,7 @@ Display your ``maintenance:install`` options:: This example completes the installation:: cd /var/www/nextcloud/ - sudo -u www-data php occ maintenance:install --database + sudo -E -u www-data php occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "root" --database-pass "password" --admin-user "admin" --admin-pass "password" Nextcloud is not installed - only a limited number of commands are available @@ -1935,9 +1933,9 @@ Command line upgrade These commands are available only after you have downloaded upgraded packages or tar archives, and before you complete the upgrade. -List all options, like this example on CentOS Linux:: +List all options:: - sudo -u apache php occ upgrade -h + sudo -E -u www-data php occ upgrade -h Usage: upgrade [--quiet] @@ -1960,7 +1958,7 @@ state. After performing all the preliminary steps (see :doc:`../maintenance/upgrade`) use this command to upgrade your databases, like this example on CentOS Linux. Note how it details the steps:: - sudo -u www-data php occ upgrade + sudo -E -u www-data php occ upgrade Nextcloud or one of the apps require upgrade - only a limited number of commands are available Turned on maintenance mode @@ -1976,7 +1974,7 @@ like this example on CentOS Linux. Note how it details the steps:: Enabling verbosity displays timestamps:: - sudo -u www-data php occ upgrade -v + sudo -E -u www-data php occ upgrade -v Nextcloud or one of the apps require upgrade - only a limited number of commands are available 2015-06-23T09:06:15+0000 Turned on maintenance mode 2015-06-23T09:06:15+0000 Checked database schema update @@ -2010,13 +2008,13 @@ In the case of a user losing access to the second factor (e.g. lost phone with two-factor SMS verification), the admin can try to disable the two-factor check for that user via the occ command:: - sudo -u www-data php occ twofactorauth:disable + sudo -E -u www-data php occ twofactorauth:disable .. note:: This is not supported by all providers. To re-enable two-factor auth again use the following command:: - sudo -u www-data php occ twofactorauth:enable + sudo -E -u www-data php occ twofactorauth:enable .. note:: This is not supported by all providers. @@ -2026,11 +2024,11 @@ Disable users ------------- Admins can disable users via the occ command too:: - sudo -u www-data php occ user:disable + sudo -E -u www-data php occ user:disable Use the following command to enable the user again:: - sudo -u www-data php occ user:enable + sudo -E -u www-data php occ user:enable Note that once users are disabled, their connected browsers will be disconnected. @@ -2042,21 +2040,21 @@ System Tags List tags:: - sudo -u www-data php occ tag:list + sudo -E -u www-data php occ tag:list Add a tag:: - sudo -u www-data php occ tag:add + sudo -E -u www-data php occ tag:add Edit a tag:: - sudo -u www-data php occ tag:edit --name --access + sudo -E -u www-data php occ tag:edit --name --access `--name` and `--access` are optional. Delete a tag:: - sudo -u www-data php occ tag:delete + sudo -E -u www-data php occ tag:delete Access level @@ -2078,19 +2076,19 @@ Antivirus Get info about files in the scan queue:: - sudo -u www php occ files_antivirus:status [-v] + sudo -E -u www-data php occ files_antivirus:status [-v] Manually trigger the background scan:: - sudo -u www php occ files_antivirus:background-scan [-v] [-m MAX] + sudo -E -u www-data php occ files_antivirus:background-scan [-v] [-m MAX] Manually scan a single file:: - sudo -u www php occ files_antivirus:scan + sudo -E -u www-data php occ files_antivirus:scan Mark a file as scanned or unscanned:: - sudo -u www php occ files_antivirus:mark + sudo -E -u www-data php occ files_antivirus:mark .. _setupchecks_commands_label: @@ -2099,7 +2097,7 @@ Setupchecks Run the setupchecks via occ:: - sudo -u www php occ setupchecks + sudo -E -u www-data php occ setupchecks Example output:: @@ -2135,4 +2133,4 @@ Debugging In certain situations it's necessary to generate debugging information, e.g. before submitting a bug report. You can run ``occ`` with debug logging:: - sudo -u www-data NC_loglevel=0 php occ -h + NC_loglevel=0 sudo -E -u www-data php occ -h diff --git a/admin_manual/webhook_listeners/index.rst b/admin_manual/webhook_listeners/index.rst index de8aecaaa..226d1ab6c 100644 --- a/admin_manual/webhook_listeners/index.rst +++ b/admin_manual/webhook_listeners/index.rst @@ -52,13 +52,13 @@ It would be best to run one command per screen session or per tmux window/pane t .. code-block:: - set -e; while true; do sudo -u www-data occ background-job:worker -v -t 60 "OCA\WebhookListeners\BackgroundJobs\WebhookCall"; done + set -e; while true; do sudo -E -u www-data php occ background-job:worker -v -t 60 "OCA\WebhookListeners\BackgroundJobs\WebhookCall"; done For Nextcloud-AIO you should use this command on the host server. .. code-block:: - set -e; while true; do sudo docker exec -u www-data -it nextcloud-aio-nextcloud php occ background-job:worker -v -t 60 "OCA\WebhookListeners\BackgroundJobs\WebhookCall"; done + set -e; while true; do sudo docker exec -it nextcloud-aio-nextcloud docker exec -it nextcloud-aio-nextcloud sudo -E -u www-data php occ background-job:worker -v -t 60 "OCA\WebhookListeners\BackgroundJobs\WebhookCall"; done You may want to adjust the number of workers and the timeout (in seconds) to your needs. The logs of the worker can be checked by attaching to the screen or tmux session. @@ -90,7 +90,7 @@ Systemd service #!/bin/sh echo "Starting Nextcloud Webhook Worker $1" cd /path/to/nextcloud - sudo -u www-data php occ background-job:worker -t 60 'OCA\WebhookListeners\BackgroundJobs\WebhookCall' + sudo -E -u www-data php occ background-job:worker -t 60 'OCA\WebhookListeners\BackgroundJobs\WebhookCall' You may want to adjust the timeout to your needs (in seconds). diff --git a/developer_manual/digging_deeper/profiler.rst b/developer_manual/digging_deeper/profiler.rst index 9da9af0d7..ed4ac591c 100644 --- a/developer_manual/digging_deeper/profiler.rst +++ b/developer_manual/digging_deeper/profiler.rst @@ -15,7 +15,7 @@ using the latest development version of Nextcloud. cd apps/ git clone --branch stableX https://github.com/nextcloud/profiler.git - # adapt X to your Nextcloud version: php occ version | grep -oP 'Nextcloud \K\d+' + # adapt X to your Nextcloud version: sudo -E -u www-data php occ version | grep -oP 'Nextcloud \K\d+' cd profiler cd ../.. diff --git a/developer_manual/exapp_development/faq/BehindCompanyProxy.rst b/developer_manual/exapp_development/faq/BehindCompanyProxy.rst index bee753a51..e22e2d02f 100644 --- a/developer_manual/exapp_development/faq/BehindCompanyProxy.rst +++ b/developer_manual/exapp_development/faq/BehindCompanyProxy.rst @@ -12,7 +12,7 @@ When running the command: .. code-block:: bash - php occ app_api:app:register test-deploy docker_socket_proxy --info-xml https://raw.githubusercontent.com/nextcloud/test-deploy/main/appinfo/info.xml --test-deploy-mode --no-ansi --no-warnings + sudo -E -u www-data php occ app_api:app:register test-deploy docker_socket_proxy --info-xml https://raw.githubusercontent.com/nextcloud/test-deploy/main/appinfo/info.xml --test-deploy-mode --no-ansi --no-warnings You may receive an error similar to: @@ -92,7 +92,7 @@ Method 1: Edit PHP CLI php.ini File .. code-block:: bash - php occ app_api:app:register + sudo -E -u www-data php occ app_api:app:register It should now be able to access the Internet through the proxy. @@ -136,7 +136,7 @@ Method 2: Set System-Wide Environment Variables .. code-block:: bash - php occ app_api:app:register test-deploy docker_socket_proxy --info-xml https://raw.githubusercontent.com/nextcloud/test-deploy/main/appinfo/info.xml --test-deploy-mode --no-ansi --no-warnings + sudo -E -u www-data test-deploy docker_socket_proxy --info-xml https://raw.githubusercontent.com/nextcloud/test-deploy/main/appinfo/info.xml --test-deploy-mode --no-ansi --no-warnings It should now work without connectivity issues. diff --git a/developer_manual/exapp_development/tech_details/Deployment.rst b/developer_manual/exapp_development/tech_details/Deployment.rst index 75cc959d5..490ae1510 100644 --- a/developer_manual/exapp_development/tech_details/Deployment.rst +++ b/developer_manual/exapp_development/tech_details/Deployment.rst @@ -58,7 +58,7 @@ Example of ``occ`` **app_api:daemon:register** command: .. code-block:: bash - sudo -u www-data php occ app_api:daemon:register docker_local_sock "My Local Docker" docker-install http /var/run/docker.sock "https://nextcloud.local" --net nextcloud + sudo -E -u www-data php occ app_api:daemon:register docker_local_sock "My Local Docker" docker-install http /var/run/docker.sock "https://nextcloud.local" --net nextcloud ExApp registration @@ -97,7 +97,7 @@ For all examples and applications we release, we usually add the ``manual_instal .. code-block:: - php occ app_api:app:register nc_py_api manual_install --json-info \ + sudo -E -u www-data php occ app_api:app:register nc_py_api manual_install --json-info \ "{\"id\":\"nc_py_api\",\"name\":\"nc_py_api\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":$APP_PORT}" \ .. note:: diff --git a/style_guide.rst b/style_guide.rst index 2a93d90a4..dceb0e5fd 100644 --- a/style_guide.rst +++ b/style_guide.rst @@ -94,12 +94,12 @@ This is how they render: Use double-backticks for inline code and command examples:: - ``sudo -u www-data php occ files:scan --help`` + ``sudo -E -u www-data php occ files:scan --help`` ``maintenance:install`` This is how they render: -``sudo -u www-data php occ files:scan --help`` +``sudo -E -u www-data php occ files:scan --help`` ``maintenance:install``