Jailkit 用户无法执行 Nextcloud OCC 命令

Jailkit 用户无法执行 Nextcloud OCC 命令

我全新安装了 nextcloud 22.2.0,安装方式按照 [这些说明:]1

安装 NC 后,我的 NC 日志中没有任何错误。但是,在“概述”部分,我有一些基本错误,我知道这些错误是新安装后的“误报”。我想在那里运行 NC occ 来修复问题:

./occ integrity:check-core

但是,我收到这些错误:

Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.

Cannot create "data" directory
This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/22/go.php?to=admin-dir_permissions

Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed
Please install one of these locales on your system and restart your webserver.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /web/lib/private/Console/Application.php:162
Stack trace:
#0 /web/console.php(98): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /web/occ(11): require_once('/web/console.ph...')
#2 {main}

我能够解决这个错误:

Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed
    Please install one of these locales on your system and restart your webserver.

通过使用:

chattr -i /var/www/clients/client1/web19/
jk_cp -j /var/www/clients/client1/web19/ /usr/lib/locale
chattr +i /var/www/clients/client1/web19/

谁能告诉我如何解决剩下的两个错误,以便 NC occ 正常工作?

谢谢

此外,用户的权限是正确的:

# ls -la /var/www/clients/client1/web19 
total 60
drwxr-xr-x 15 root  root    4096 Nov 12 15:12 .
drwxr-xr-x  9 root  root    4096 Nov 12 14:50 ..
lrwxrwxrwx  1 root  root       7 Nov 12 15:09 bin -> usr/bin
drwxr-xr-x  2 web19 client1 4096 Nov 12 14:50 cgi-bin
drwxr-xr-x  2 root  root    4096 Nov 12 17:36 dev
drwxr-xr-x  8 root  root    4096 Nov 12 15:12 etc
drwxr-xr-x  4 root  root    4096 Nov 12 15:12 home
lrwxrwxrwx  1 root  root       7 Nov 12 15:09 lib -> usr/lib
lrwxrwxrwx  1 root  root       9 Nov 12 15:09 lib64 -> usr/lib64
drwxr-xr-x  2 root  root    4096 Nov 12 19:58 log
drwx--x---  2 web19 client1 4096 Nov 12 20:05 private
drwx------  2 web19 client1 4096 Nov 12 15:09 .ssh
drwxr-xr-x  2 root  root    4096 Nov 12 14:55 ssl
drwxrwx---  2 web19 client1 4096 Nov 12 20:09 tmp
drwxr-xr-x  8 root  root    4096 Nov 12 15:09 usr
drwxr-xr-x  4 root  root    4096 Nov 12 15:12 var
drwx--x--x 14 web19 client1 4096 Nov 12 20:09 web
drwx--x---  2 web19 client1 4096 Nov 12 14:50 webdav

答案1

我认为这是一个不太优雅的解决方案,我希望有人可以改进它。

我一直专注于执行

./occ integrity:check-core

以 shell 用户身份从 jailkit 内部进入。

我可以以系统 root 用户身份成功执行以下命令:

sudo -u web4 /var/www/clients/client1/web4/usr/bin/php /var/www/clients/client1/web4/web/occ integrity:check-core

对于我个人使用来说,这是一个非常好的解决方案,但是有人可以解释以 shell 用户身份运行此命令吗?

sudo -u web4 php ./occ integrity: check-core

是的,我已经将 sudo 二进制文件和 lib 复制到 jailkit 中,我只得到这个输出我以 jailkit 用户身份尝试上述命令:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

相关内容