2014-01-14 16:01:16.6573 20624/7fa7c8806700 Pool2/SmartSpawner.h:301 ]: Preloader for /var/www/socialrest_homepage started on PID 20686,listening on unix:/tmp/passenger.1.0.20618/generation-0/backends/preloader.20686 App 20704 stdout: [Tue Jan 14 16:01:17 2014] [error] [client 168.215.171.129] Premature end of script headers: App 20686 stderr: /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tmpdir.rb:34:in `tmpdir': could not find a temporary directory (ArgumentError) App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/utils/tmpio.rb:17:in `new' App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/utils/tee_input.rb:99:in `initialize' App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/rack/thread_handler_extension.rb:55:in `new' App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/rack/thread_handler_extension.rb:55:in `process_request' App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' App 20686 stderr: from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/lib/phusion_passenger/request_handler.rb:440:in `block (3 levels) in start_threads' [ 2014-01-14 16:01:21.0163 20624/7fa7cb242700 Pool2/Pool.h:776 ]: Process (pid=20704,group=/var/www/socialrest_homepage#default) no longer exists! Detaching it from the pool. App 20720 stdout:
这是我当前的/ tmp和config / environment.rb所有权:
drwxrwxrwx 5 root root 4.0K Jan 14 16:01 tmp -rwxr-xr-x 1 root root 196 Jan 13 20:06 environment.rb
解决方法
could not find a temporary directory (ArgumentError)
当你告诉Ruby> = 2.0创建一个临时文件时,它会查找一个可以安全地创建文件的目录.在任何人可以替换文件的目录中创建临时文件将是一个很大(和常见)的安全漏洞!
你有两个可能性:
>通过将其中一个环境变量TMPDIR或TMP或TEMP设置为安全目录,告诉ruby可以安全地创建临时文件的位置.
>修复ruby尝试使用的目录的权限. Ruby尝试使用的目录:systempdir(“/ tmp”)和当前目录
如果目录不是可写入的,或者设置了粘滞位,Ruby会认为目录是安全的. (不要将粘性位(t)与seteuid / setgid位混淆!)
因此,您可以将工作目录设置为不可写入或执行以下操作,而不是设置TMPDIR:
chmod +t /tmp
chmod的手册页解释了粘滞位的使用:
[It] prevents unprivileged users from removing or renaming a file in the directory unless they own the file or the directory; this is called the restricted deletion flag for the directory,and is commonly found on world-writable directories like /tmp.
另见:https://blog.diacode.com/fixing-temporary-dir-problems-with-ruby-2
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。