I have a simple app that allows users to upload image files to the web server. It works fine on my laptop with Webrick, when I deploy to the web server it also works fine with webrick. However, when I try to connect via Apache, the files get uploaded to the /tmp directory, but the never make it to the correct directory within the application (/ public/images/photos). I am sure that this is some permissions problem with the Apache user (Apache runs as user:nobody, group:nobody) but it appears that all of the correct permissions are in place. Here are the permissions on the photos directory: drwxrwxr-x 2 jzw nobody 4096 Jun 13 15:18 photos/ And here is the error: Errno::EACCES (Permission denied - public/images/photos/28-full.jpg): /home/jzw/public_html/my_app/app/models/photo.rb:261:in `initialize'' /home/jzw/public_html/my_app/app/models/photo.rb:261:in `open'' /home/jzw/public_html/my_app/app/models/photo.rb:261:in `save_full'' /home/jzw/public_html/my_app/app/models/photo.rb:250:in `save_file'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in `send'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in `callback'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in `each'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in `callback'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:243:in `create_or_update'' /vendor/rails/activerecord/lib/active_record/base.rb:1548:in `save_without_validation'' /vendor/rails/activerecord/lib/active_record/validations.rb:752:in `save_without_transactions'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 129:in `save'' /vendor/rails/activerecord/lib/active_record/connection_adapters/ abstract/database_statements.rb:59:in `transaction'' /home/jzw/public_html/my_app/public/dispatch.fcgi:34 Errno::EACCES (Permission denied - public/images/photos/28-full.jpg): /home/jzw/public_html/my_app/app/models/photo.rb:261:in `initialize'' /home/jzw/public_html/my_app/app/models/photo.rb:261:in `open'' /home/jzw/public_html/my_app/app/models/photo.rb:261:in `save_full'' /home/jzw/public_html/my_app/app/models/photo.rb:250:in `save_file'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in `send'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in `callback'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in `each'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in `callback'' /vendor/rails/activerecord/lib/active_record/callbacks.rb:243:in `create_or_update'' /vendor/rails/activerecord/lib/active_record/base.rb:1548:in `save_without_validation'' /vendor/rails/activerecord/lib/active_record/validations.rb:752:in `save_without_transactions'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 129:in `save'' /vendor/rails/activerecord/lib/active_record/connection_adapters/ abstract/database_statements.rb:59:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb:95:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 121:in `transaction'' /vendor/rails/activerecord/lib/active_record/transactions.rb: 129:in `save'' /home/jzw/public_html/my_app/app/controllers/admin/ photos_controller.rb:79:in `new_or_edit'' /home/jzw/public_html/my_app/app/controllers/admin/ photos_controller.rb:22:in `new'' /vendor/rails/actionpack/lib/action_controller/base.rb:1097:in `send'' /vendor/rails/actionpack/lib/action_controller/base.rb:1097:in `perform_action_without_filters'' /vendor/rails/actionpack/lib/action_controller/filters.rb:723:in `call_filters'' /vendor/rails/actionpack/lib/action_controller/filters.rb:713:in `call_filters'' /vendor/rails/actionpack/lib/action_controller/filters.rb:661:in `call'' /vendor/rails/actionpack/lib/action_controller/filters.rb:661:in `proxy_before_and_after_filter'' /vendor/rails/actionpack/lib/action_controller/filters.rb:482:in `call'' /vendor/rails/actionpack/lib/action_controller/filters.rb:482:in `call'' /vendor/rails/actionpack/lib/action_controller/filters.rb:711:in `call_filters'' /vendor/rails/actionpack/lib/action_controller/filters.rb:680:in `perform_action_without_benchmark'' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: 66:in `perform_action_without_rescue'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: 66:in `perform_action_without_rescue'' /vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'' Any help is greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It has been a couple of weeks and I still have not figured this out.... Surely someone out there has an idea.... On Jun 13, 4:17 pm, jzw <john.zachary.willi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a simple app that allows users to upload image files to the web > server. It works fine on my laptop with Webrick, when I deploy to the > web server it also works fine with webrick. However, when I try to > connect via Apache, the files get uploaded to the /tmp directory, but > the never make it to the correct directory within the application (/ > public/images/photos). I am sure that this is some permissions > problem with the Apache user (Apache runs as user:nobody, > group:nobody) but it appears that all of the correct permissions are > in place. Here are the permissions on the photos directory: > > drwxrwxr-x 2 jzw nobody 4096 Jun 13 15:18 photos/ > > And here is the error: > > Errno::EACCES (Permission denied - public/images/photos/28-full.jpg): > /home/jzw/public_html/my_app/app/models/photo.rb:261:in > `initialize'' > /home/jzw/public_html/my_app/app/models/photo.rb:261:in `open'' > /home/jzw/public_html/my_app/app/models/photo.rb:261:in > `save_full'' > /home/jzw/public_html/my_app/app/models/photo.rb:250:in > `save_file'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in > `send'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in > `callback'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in > `each'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in > `callback'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:243:in > `create_or_update'' > /vendor/rails/activerecord/lib/active_record/base.rb:1548:in > `save_without_validation'' > /vendor/rails/activerecord/lib/active_record/validations.rb:752:in > `save_without_transactions'' > /vendor/rails/activerecord/lib/active_record/transactions.rb: > 129:in `save'' > /vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/database_statements.rb:59:in `transaction'' > /home/jzw/public_html/my_app/public/dispatch.fcgi:34 > > Errno::EACCES (Permission denied - public/images/photos/28-full.jpg): > /home/jzw/public_html/my_app/app/models/photo.rb:261:in > `initialize'' > /home/jzw/public_html/my_app/app/models/photo.rb:261:in `open'' > /home/jzw/public_html/my_app/app/models/photo.rb:261:in > `save_full'' > /home/jzw/public_html/my_app/app/models/photo.rb:250:in > `save_file'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in > `send'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:333:in > `callback'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in > `each'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in > `callback'' > /vendor/rails/activerecord/lib/active_record/callbacks.rb:243:in > `create_or_update'' > /vendor/rails/activerecord/lib/active_record/base.rb:1548:in > `save_without_validation'' > /vendor/rails/activerecord/lib/active_record/validations.rb:752:in > `save_without_transactions'' > /vendor/rails/activerecord/lib/active_record/transactions.rb: > 129:in `save'' > /vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/database_statements.rb:59:in `transaction'' > /vendor/rails/activerecord/lib/active_record/transactions.rb:95:in > `transaction'' > /vendor/rails/activerecord/lib/active_record/transactions.rb: > 121:in `transaction'' > /vendor/rails/activerecord/lib/active_record/transactions.rb: > 129:in `save'' > /home/jzw/public_html/my_app/app/controllers/admin/ > photos_controller.rb:79:in `new_or_edit'' > /home/jzw/public_html/my_app/app/controllers/admin/ > photos_controller.rb:22:in `new'' > /vendor/rails/actionpack/lib/action_controller/base.rb:1097:in > `send'' > /vendor/rails/actionpack/lib/action_controller/base.rb:1097:in > `perform_action_without_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:723:in > `call_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:713:in > `call_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:661:in > `call'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:661:in > `proxy_before_and_after_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:482:in > `call'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:482:in > `call'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:711:in > `call_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:680:in > `perform_action_without_benchmark'' > /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: > 66:in `perform_action_without_rescue'' > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: > 66:in `perform_action_without_rescue'' > /vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in > `perform_action'' > > Any help is greatly appreciated.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m puzzled why Apache''s should be the relevant user as it doesn''t execute Rails code. But to test further if it is indeed a permissions issue, try either setting permissions to 777 (or 766) on that directory, or making nobody the owner (not just the group). Personally, I wouldn''t try to give permissions to nobody as the whole point of that account is that it has none (which is an issue that crops up for Web DAV fairly frequently, see for example <http:// www.lyra.org/pipermail/dav-dev/2001-August/002676.html>). But creating world writeable directories also has issues. So perhaps run apache as www group www and manage it as a real user -- if that is indeed the problem. On 28 Jun 2007, at 23:52, jzw wrote:> > It has been a couple of weeks and I still have not figured this > out.... Surely someone out there has an idea.... > > On Jun 13, 4:17 pm, jzw <john.zachary.willi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I have a simple app that allows users to upload image files to the >> web >> server. It works fine on my laptop with Webrick, when I deploy to the >> web server it also works fine with webrick. However, when I try to >> connect via Apache, the files get uploaded to the /tmp directory, but >> the never make it to the correct directory within the application (/ >> public/images/photos). I am sure that this is some permissions >> problem with the Apache user (Apache runs as user:nobody, >> group:nobody) but it appears that all of the correct permissions are >> in place. Here are the permissions on the photos directory: >> >> drwxrwxr-x 2 jzw nobody 4096 Jun 13 15:18 photos/ >>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---