From f64d14217781e72bb56099802a5aba48888bba52 Mon Sep 17 00:00:00 2001 From: exu Date: Fri, 21 Jul 2023 13:17:01 +0200 Subject: [PATCH] Use cool `su` instead of `sudo` --- pages/02.linux/nextcloud/default.en.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pages/02.linux/nextcloud/default.en.md b/pages/02.linux/nextcloud/default.en.md index 58b0bf7..6783028 100644 --- a/pages/02.linux/nextcloud/default.en.md +++ b/pages/02.linux/nextcloud/default.en.md @@ -122,13 +122,13 @@ systemctl restart apache2 To execute regular jobs, I personally use cron. Edit `crontab` as the `www-data` user. -[shuser] +[shroot] ```sh -sudo -u www-data crontab -e +su -s /bin/sh -c 'crontab -e' www-data ``` -[/shuser] +[/shroot] Add this following line: @@ -180,25 +180,25 @@ Array of trusted domains. Enable maintenance mode to prevent data inconsistencies -[shuser] +[shroot] ```sh -sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on +su -s /bin/sh -c 'php /var/www/nextcloud/occ maintenance:mode --on' www-data ``` -[/shuser] +[/shroot] To disable maintenance mode again, run the same command with `--off` instead of `--on` ### Upgrade with CLI -[shuser] +[shroot] ```sh -sudo -u www-data php /var/www/nextcloud/updater/updater.phar +su -s /bin/sh -c 'php /var/www/nextcloud/updater/updater.phar' www-data ``` -[/shuser] +[/shroot] Always check the admin status page after an upgrade. Sometimes additional steps are needed to fully complete the upgrade @@ -206,13 +206,13 @@ Always check the admin status page after an upgrade. Sometimes additional steps The missing indices can be added using `occ` -[shuser] +[shroot] ```sh -sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices +su -s /bin/sh -c 'php /var/www/nextcloud/occ db:add-missing-indices' www-data ``` -[/shuser] +[/shroot] ### Backup Database