好吧,首先我确定会有一些“额外的信息”请求,所以请在OP评论中发布,我会尽我所能提供额外的信息!
这里是瘦,首先是服务器:
它是一个共享的登台服务器,Ubuntu 16.4 LTS与Apache2.4,Php7.1,Mysql 5.7。 它有Webmin,VirtualMin和UserMin安装(最新)。 它也有phpMyAdmin全球安装。 它的configuration允许站点使用mod_php(使用www-data),CGI,FCGI(默认)或FPM + FCGI。 CGI / FPM varients使用SuExec来执行这些站点。 Web服务器本身完美地工作。
所以,现在的任务是build立一个Chroot监狱,允许现有的域用户使用SSH或SFTP,但只能看到他们的主目录,这个目录已经被最新的Magento 2安装。
在这个例子中,我们将使用这些细节:
User = domain Group = domain Home Dir = / home / domain / Chroot = / var / chroot /
现在,我可以设置Chroot罚款,我所做的是复制需要的relivent lib / var / usr文件,允许命令ls,bash,sh,rm,rmdir,mkdir,touch,vi和php。
它花了一些工作,但我得到的PHP命令工作(find所有的模块依赖之后)几乎正确。
CHroot监狱是好的,我登上了/ home / domain / var / chroot / home / domain,所以这很好。 用户被有效监禁,并可以看到用户的主目录,从而可以访问所有的网站文件没有问题。
Databasewise我省略了mysql命令,因为我们有全局可用的phpmyadmin,所以他们只能使用专用域mysql用户login到releivent数据库。 没有问题。
真正的问题来自Magento 2.在这里,我们知道你使用命令行工具来做caching刷新,索引build立和其他部署任务,例如:
domain@server:/home/domain/public_html# php bin/magento cache:flush domain@server:/home/domain/public_html# php bin/magento indexer:reindex domain@server:/home/domain/public_html# php bin/magento setup:static-content:deploy en_US
正如我们所看到的,这些命令是通过PHP CLI解释器运行的,所以让所有的PHP在监狱的CLI上正常工作。
起初,我得到cache:flush数据库问题,但与CLI的php.ini的一些摆弄(我从用户家中复制FCGI一个入狱)和一些“find正确的mysql.sock”我修正了没有probs(好吧,一些probs但固定它!)
实际的问题
我有一个indexer:reindex的问题indexer:reindex具有root权限的indexer:reindex没有问题,但是在Chroot中作为用户域出于某种原因,除了第一个索引之外,所有的命令都会抛出错误。 结果如下:
-bash-4.3$ cd /home/domain/public_html/ -bash-4.3$ php bin/magento indexer:reindex Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Category Products indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Product Categories indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Product Price indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Catalog Rule Product indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Catalog Product Rule indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 Catalog Search indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
好的,我说,这是某种会话创build失败,然后索引器无法读取未能创build的会话。 解释为什么第一个工作,但子代失败。 我试图把默认的PHS挂载到chroot监狱,所以我挂载了/var/lib/php/到/var/chroot/var/lib/php 。 这个目录有点粘,所以我虽然而不是创build我会挂载。
还没有骰子。 我很好,如果我一次重新索引一个:
-bash-4.3$ php bin/magento indexer:reindex customer_grid Customer Grid indexer process unknown error: Warning: SessionHandler::read(): open(/home/domain/tmp/sess_en89p7h50m9mc1a0pb8l3c3tv1, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
还没有骰子。 我正在努力看看它实际上在挣扎着什么,在哪里得到这个假设的会话ID,它应该在哪里创build会话文件,以及我可以在哪里查看信息!
任何人都可以提出什么样的build议,让M前进,并掌握Magento 2网站用户的SH监狱?
试试ls -l /home/domain/和ls -l /home/domain/tmp ,看起来像是你的目录有错误的权限,或者两者都是错误的。
PHP试图访问一个会话文件,并失败。 或者该文件存在且domain没有读取权限,或该文件不存在,并且该domain对该目录没有写入权限。
回答我自己的问题,因为我已经设法解决这个问题。
2件事情错了:
这就是为什么我可以在/ var / lib / php / sessions中以root用户身份创build会话文件的原因,但是在chroot jail中却无法创build会话文件,因为它是以错误的权限将其放到错误的地方。
所以更新了正确的php.ini和审查权限,愉快的日子,我们有一个会议! indexer:reindex正在工作!
setup:static-content:deploy ,我只能说“你知道当脚本抛出很多错误时,你不能在CLI里得到它的顶部吗? Erk:/ 这是(我最终find)我可怜的键盘技能。 当我把用户目录挂在监狱里时,我错误地input了目录名,所以path/ home / domain / public_html不是/ jail / domain / public_html。 快速重新安装,一切都很好。
所以现在问题解决了,感谢ThoriumBR他的有用的build议! Leasons学会了,希望这个故事可能会帮助其他人。