having a file saving permissions problem from within a controller... f = File.new("/home/path/to/I-A-files.txt", "w") f.syswrite(output) f.close The error... Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): this file path is not within RAILS path but rather outside of it. files saved without a path are clearly saved in the RAILS_ROOT directory as user ''craig'' user ''craig'' clearly has permissions to save files in that path (actually, the path is an NFS mounted path but I don''t see why that should matter) Obviously I am missing some bit of information that would tell me why this fails. TIA Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
how are you running rails? Through mongrel? Is your mongrel instance running as user craig? Mike On 3/11/08, Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> > having a file saving permissions problem from within a controller... > > f = File.new("/home/path/to/I-A-files.txt", "w") > f.syswrite(output) > f.close > > The error... > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > this file path is not within RAILS path but rather outside of it. > > files saved without a path are clearly saved in the RAILS_ROOT directory > as user ''craig'' > > user ''craig'' clearly has permissions to save files in that path > (actually, the path is an NFS mounted path but I don''t see why that > should matter) > > Obviously I am missing some bit of information that would tell me why > this fails. > > TIA > > Craig > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, 2008-03-11 at 22:11 -0400, Mike Garey wrote:> how are you running rails? Through mongrel?---- yes ----> Is your mongrel instance > running as user craig?---- yes and as you can see, files ''icalout.ics'' and ''test.txt'' which are created by my ''rails application'' are definitely created by user ''craig'' ls -l drwxr-xr-x 8 craig users 4096 2007-10-11 11:32 app drwxr-xr-x 3 craig users 4096 2007-10-11 11:33 components drwxr-xr-x 4 craig users 4096 2008-01-31 16:07 config drwxr-xr-x 4 craig users 4096 2007-10-11 11:33 db drwxr-xr-x 3 craig users 4096 2007-12-28 09:38 doc -rw-r--r-- 1 craig users 1105 2008-01-30 11:53 icalout.ics drwxr-xr-x 4 craig users 4096 2008-03-04 16:57 lib drwxrwxrwx 3 craig users 4096 2008-03-11 11:39 log drwxr-xr-x 13 craig users 4096 2008-01-30 11:54 public -rw-r--r-- 1 craig users 307 2007-10-11 11:34 Rakefile -rw-r--r-- 1 craig users 6064 2007-10-11 11:34 README drwxr-xr-x 5 craig users 4096 2007-10-11 11:33 script drwxr-xr-x 7 craig users 4096 2007-10-11 11:32 test -rw-rw-rw- 1 craig users 985 2008-03-11 15:18 test.txt drwxrwxrwx 3 craig users 4096 2008-03-10 14:37 tmp drwxr-xr-x 6 craig users 4096 2008-01-31 15:30 vendor and the directory in question... $ ls -ld /home/path/to/Build-PDF/ drwxrwsrwx 2 craig administrative 4096 2008-03-11 17:24 /home/path/to/Build-PDF/ user ''craig'' clearly has write permissions and I''m clearly writing files into that directory as user ''craig'' outside of the ''rails application'' Craig ----> Mike > > On 3/11/08, Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > > having a file saving permissions problem from within a controller... > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > f.syswrite(output) > > f.close > > > > The error... > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > this file path is not within RAILS path but rather outside of it. > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > as user ''craig'' > > > > user ''craig'' clearly has permissions to save files in that path > > (actually, the path is an NFS mounted path but I don''t see why that > > should matter) > > > > Obviously I am missing some bit of information that would tell me why > > this fails. > > > > TIA--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote:> having a file saving permissions problem from within a controller... > > f = File.new("/home/path/to/I-A-files.txt", "w") > f.syswrite(output) > f.close > > The error... > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > this file path is not within RAILS path but rather outside of it. > > files saved without a path are clearly saved in the RAILS_ROOT directory > as user ''craig'' > > user ''craig'' clearly has permissions to save files in that path > (actually, the path is an NFS mounted path but I don''t see why that > should matter) > > Obviously I am missing some bit of information that would tell me why > this fails.---- OK - this is truly strange, because I can get it to work from script/console but not from within my controller...(I have removed the>> from the script/console output for readability).@qm_book = QmManual.find(:all, \ :conditions => ["section = ?", "I/A"], \ :order => ''priority'') => [# Much data deleted... }>] File.open("I-A-files.txt", "w") do |file| for qm_book in @qm_book file.write "/home/path_to/New_QM_Manual/" + \ qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" if qm_book.no_of_pages.modulo(2) != 0 file.write \ "/home/path/to/Build-PDF/blank-page.pdf" + "\n" end end file.close FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" end => 1 but this same code in my controller gets the error that I listed up top. why would file write permissions differ from script/console and controller code? mongrel? mongrel is running as me - same user. Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
are you absolutely sure mongrel is running as you? have you tried printing `whoami` from one of your controllers to see who your code is executing as? On 3/12/08, Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote:> > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > having a file saving permissions problem from within a controller... > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > f.syswrite(output) > > f.close > > > > The error... > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > this file path is not within RAILS path but rather outside of it. > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > as user ''craig'' > > > > user ''craig'' clearly has permissions to save files in that path > > (actually, the path is an NFS mounted path but I don''t see why that > > should matter) > > > > Obviously I am missing some bit of information that would tell me why > > this fails. > > ---- > OK - this is truly strange, because I can get it to work from > script/console but not from within my controller...(I have removed the > >> from the script/console output for readability). > > @qm_book = QmManual.find(:all, \ > :conditions => ["section = ?", "I/A"], \ > :order => ''priority'') > => [# Much data deleted... }>] > File.open("I-A-files.txt", "w") do |file| > for qm_book in @qm_book > file.write "/home/path_to/New_QM_Manual/" + \ > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > if qm_book.no_of_pages.modulo(2) != 0 > file.write \ > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > end > end > file.close > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > end > => 1 > > but this same code in my controller gets the error that I listed up top. > > why would file write permissions differ from script/console and > controller code? mongrel? mongrel is running as me - same user. > > > Craig > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Good thought...I am just starting to tinker with backticks and executing shell commands. thus, in contoller code, flash[:notice] = `whoami` just confirmed it is me, which I had to believe was the case since a simple `ps aux |grep mongrel` also tells me the same thing. The issue is somewhat confusing... I am using various NFS mounts including my $HOME directory and I can save files in that tree but not on other mounts. The curious thing is that what works in script/console does not work in controller code so I''m gathering that it has something to do with mongrel. mongrel_cluster (1.0.2) Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes. checking to see if there''s an update but I don''t hold out much hope for it changing things Craig On Wed, 2008-03-12 at 16:46 -0400, Mike Garey wrote:> are you absolutely sure mongrel is running as you? have you tried > printing `whoami` from one of your controllers to see who your code is > executing as? > > > > On 3/12/08, Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > > having a file saving permissions problem from within a controller... > > > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > > f.syswrite(output) > > > f.close > > > > > > The error... > > > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > > > this file path is not within RAILS path but rather outside of it. > > > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > > as user ''craig'' > > > > > > user ''craig'' clearly has permissions to save files in that path > > > (actually, the path is an NFS mounted path but I don''t see why that > > > should matter) > > > > > > Obviously I am missing some bit of information that would tell me why > > > this fails. > > > > ---- > > OK - this is truly strange, because I can get it to work from > > script/console but not from within my controller...(I have removed the > > >> from the script/console output for readability). > > > > @qm_book = QmManual.find(:all, \ > > :conditions => ["section = ?", "I/A"], \ > > :order => ''priority'') > > => [# Much data deleted... }>] > > File.open("I-A-files.txt", "w") do |file| > > for qm_book in @qm_book > > file.write "/home/path_to/New_QM_Manual/" + \ > > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > > if qm_book.no_of_pages.modulo(2) != 0 > > file.write \ > > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > > end > > end > > file.close > > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > > end > > => 1 > > > > but this same code in my controller gets the error that I listed up top. > > > > why would file write permissions differ from script/console and > > controller code? mongrel? mongrel is running as me - same user. > > > > > > Craig > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
sort of solved anyway...I ended up making symbolic links from the target directory into a directory inside my RAILS_ROOT path and I can now save files, etc. this is strange behavior... Anyway, I wanted to leave tracks in case anyone follows down my path. Craig On Wed, 2008-03-12 at 14:02 -0700, Craig White wrote:> Good thought...I am just starting to tinker with backticks and executing > shell commands. > > thus, in contoller code, flash[:notice] = `whoami` > > just confirmed it is me, which I had to believe was the case since a > simple `ps aux |grep mongrel` also tells me the same thing. > > The issue is somewhat confusing... > > I am using various NFS mounts including my $HOME directory and I can > save files in that tree but not on other mounts. The curious thing is > that what works in script/console does not work in controller code so > I''m gathering that it has something to do with mongrel. > > mongrel_cluster (1.0.2) > Mongrel plugin that provides commands and Capistrano tasks for > managing multiple Mongrel processes. > > checking to see if there''s an update but I don''t hold out much hope for > it changing things > > Craig > > On Wed, 2008-03-12 at 16:46 -0400, Mike Garey wrote: > > are you absolutely sure mongrel is running as you? have you tried > > printing `whoami` from one of your controllers to see who your code is > > executing as? > > > > > > > > On 3/12/08, Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > > > > > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > > > having a file saving permissions problem from within a controller... > > > > > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > > > f.syswrite(output) > > > > f.close > > > > > > > > The error... > > > > > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > > > > > this file path is not within RAILS path but rather outside of it. > > > > > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > > > as user ''craig'' > > > > > > > > user ''craig'' clearly has permissions to save files in that path > > > > (actually, the path is an NFS mounted path but I don''t see why that > > > > should matter) > > > > > > > > Obviously I am missing some bit of information that would tell me why > > > > this fails. > > > > > > ---- > > > OK - this is truly strange, because I can get it to work from > > > script/console but not from within my controller...(I have removed the > > > >> from the script/console output for readability). > > > > > > @qm_book = QmManual.find(:all, \ > > > :conditions => ["section = ?", "I/A"], \ > > > :order => ''priority'') > > > => [# Much data deleted... }>] > > > File.open("I-A-files.txt", "w") do |file| > > > for qm_book in @qm_book > > > file.write "/home/path_to/New_QM_Manual/" + \ > > > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > > > if qm_book.no_of_pages.modulo(2) != 0 > > > file.write \ > > > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > > > end > > > end > > > file.close > > > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > > > end > > > => 1 > > > > > > but this same code in my controller gets the error that I listed up top. > > > > > > why would file write permissions differ from script/console and > > > controller code? mongrel? mongrel is running as me - same user. > > > > > > > > > Craig > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maybe mongrel is running in a chroot jail? Have you checked what \ is for it? On Mar 13, 12:14 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> sort of solved anyway...I ended up making symbolic links from the target > directory into a directory inside my RAILS_ROOT path and I can now save > files, etc. > > this is strange behavior... > > Anyway, I wanted to leave tracks in case anyone follows down my path. > > Craig > > On Wed, 2008-03-12 at 14:02 -0700, Craig White wrote: > > Good thought...I am just starting to tinker with backticks and executing > > shell commands. > > > thus, in contoller code, flash[:notice] = `whoami` > > > just confirmed it is me, which I had to believe was the case since a > > simple `ps aux |grep mongrel` also tells me the same thing. > > > The issue is somewhat confusing... > > > I am using various NFS mounts including my $HOME directory and I can > > save files in that tree but not on other mounts. The curious thing is > > that what works in script/console does not work in controller code so > > I''m gathering that it has something to do with mongrel. > > > mongrel_cluster (1.0.2) > > Mongrel plugin that provides commands and Capistrano tasks for > > managing multiple Mongrel processes. > > > checking to see if there''s an update but I don''t hold out much hope for > > it changing things > > > Craig > > > On Wed, 2008-03-12 at 16:46 -0400, Mike Garey wrote: > > > are you absolutely sure mongrel is running as you? have you tried > > > printing `whoami` from one of your controllers to see who your code is > > > executing as? > > > > On 3/12/08, Craig White <cr...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > > > > having a file saving permissions problem from within a controller... > > > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > > > > f.syswrite(output) > > > > > f.close > > > > > > The error... > > > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > > > this file path is not within RAILS path but rather outside of it. > > > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > > > > as user ''craig'' > > > > > > user ''craig'' clearly has permissions to save files in that path > > > > > (actually, the path is an NFS mounted path but I don''t see why that > > > > > should matter) > > > > > > Obviously I am missing some bit of information that would tell me why > > > > > this fails. > > > > > ---- > > > > OK - this is truly strange, because I can get it to work from > > > > script/console but not from within my controller...(I have removed the > > > > >> from the script/console output for readability). > > > > > @qm_book = QmManual.find(:all, \ > > > > :conditions => ["section = ?", "I/A"], \ > > > > :order => ''priority'') > > > > => [# Much data deleted... }>] > > > > File.open("I-A-files.txt", "w") do |file| > > > > for qm_book in @qm_book > > > > file.write "/home/path_to/New_QM_Manual/" + \ > > > > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > > > > if qm_book.no_of_pages.modulo(2) != 0 > > > > file.write \ > > > > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > > > > end > > > > end > > > > file.close > > > > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > > > > end > > > > => 1 > > > > > but this same code in my controller gets the error that I listed up top. > > > > > why would file write permissions differ from script/console and > > > > controller code? mongrel? mongrel is running as me - same user. > > > > > Craig--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Doesn''t seem to be a chroot jail because I can save files on the out of the RAILS_ROOT tree but I had to symlink the NFS mount into my RAILS_ROOT to simplify the matter...it worked. I don''t know why and I had to move on. Craig On Thu, 2008-03-13 at 13:26 -0700, stuart.coyle wrote:> Maybe mongrel is running in a chroot jail? Have you checked what \ is > for it? > > On Mar 13, 12:14 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > sort of solved anyway...I ended up making symbolic links from the target > > directory into a directory inside my RAILS_ROOT path and I can now save > > files, etc. > > > > this is strange behavior... > > > > Anyway, I wanted to leave tracks in case anyone follows down my path. > > > > Craig > > > > On Wed, 2008-03-12 at 14:02 -0700, Craig White wrote: > > > Good thought...I am just starting to tinker with backticks and executing > > > shell commands. > > > > > thus, in contoller code, flash[:notice] = `whoami` > > > > > just confirmed it is me, which I had to believe was the case since a > > > simple `ps aux |grep mongrel` also tells me the same thing. > > > > > The issue is somewhat confusing... > > > > > I am using various NFS mounts including my $HOME directory and I can > > > save files in that tree but not on other mounts. The curious thing is > > > that what works in script/console does not work in controller code so > > > I''m gathering that it has something to do with mongrel. > > > > > mongrel_cluster (1.0.2) > > > Mongrel plugin that provides commands and Capistrano tasks for > > > managing multiple Mongrel processes. > > > > > checking to see if there''s an update but I don''t hold out much hope for > > > it changing things > > > > > Craig > > > > > On Wed, 2008-03-12 at 16:46 -0400, Mike Garey wrote: > > > > are you absolutely sure mongrel is running as you? have you tried > > > > printing `whoami` from one of your controllers to see who your code is > > > > executing as? > > > > > > On 3/12/08, Craig White <cr...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > > > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > > > > > having a file saving permissions problem from within a controller... > > > > > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > > > > > f.syswrite(output) > > > > > > f.close > > > > > > > > The error... > > > > > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > > > > > this file path is not within RAILS path but rather outside of it. > > > > > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > > > > > as user ''craig'' > > > > > > > > user ''craig'' clearly has permissions to save files in that path > > > > > > (actually, the path is an NFS mounted path but I don''t see why that > > > > > > should matter) > > > > > > > > Obviously I am missing some bit of information that would tell me why > > > > > > this fails. > > > > > > > ---- > > > > > OK - this is truly strange, because I can get it to work from > > > > > script/console but not from within my controller...(I have removed the > > > > > >> from the script/console output for readability). > > > > > > > @qm_book = QmManual.find(:all, \ > > > > > :conditions => ["section = ?", "I/A"], \ > > > > > :order => ''priority'') > > > > > => [# Much data deleted... }>] > > > > > File.open("I-A-files.txt", "w") do |file| > > > > > for qm_book in @qm_book > > > > > file.write "/home/path_to/New_QM_Manual/" + \ > > > > > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > > > > > if qm_book.no_of_pages.modulo(2) != 0 > > > > > file.write \ > > > > > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > > > > > end > > > > > end > > > > > file.close > > > > > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > > > > > end > > > > > => 1 > > > > > > > but this same code in my controller gets the error that I listed up top. > > > > > > > why would file write permissions differ from script/console and > > > > > controller code? mongrel? mongrel is running as me - same user. > > > > > > > Craig > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
is your machine running SELinux? I''ve run into some very strange behaviour on my server machine which runs Redhat with SELinux enabled. Mike On 3/13/08, Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote:> > Doesn''t seem to be a chroot jail because I can save files on the out of > the RAILS_ROOT tree but I had to symlink the NFS mount into my > RAILS_ROOT to simplify the matter...it worked. I don''t know why and I > had to move on. > > > Craig > > > On Thu, 2008-03-13 at 13:26 -0700, stuart.coyle wrote: > > Maybe mongrel is running in a chroot jail? Have you checked what \ is > > for it? > > > > On Mar 13, 12:14 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > sort of solved anyway...I ended up making symbolic links from the target > > > directory into a directory inside my RAILS_ROOT path and I can now save > > > files, etc. > > > > > > this is strange behavior... > > > > > > Anyway, I wanted to leave tracks in case anyone follows down my path. > > > > > > Craig > > > > > > On Wed, 2008-03-12 at 14:02 -0700, Craig White wrote: > > > > Good thought...I am just starting to tinker with backticks and executing > > > > shell commands. > > > > > > > thus, in contoller code, flash[:notice] = `whoami` > > > > > > > just confirmed it is me, which I had to believe was the case since a > > > > simple `ps aux |grep mongrel` also tells me the same thing. > > > > > > > The issue is somewhat confusing... > > > > > > > I am using various NFS mounts including my $HOME directory and I can > > > > save files in that tree but not on other mounts. The curious thing is > > > > that what works in script/console does not work in controller code so > > > > I''m gathering that it has something to do with mongrel. > > > > > > > mongrel_cluster (1.0.2) > > > > Mongrel plugin that provides commands and Capistrano tasks for > > > > managing multiple Mongrel processes. > > > > > > > checking to see if there''s an update but I don''t hold out much hope for > > > > it changing things > > > > > > > Craig > > > > > > > On Wed, 2008-03-12 at 16:46 -0400, Mike Garey wrote: > > > > > are you absolutely sure mongrel is running as you? have you tried > > > > > printing `whoami` from one of your controllers to see who your code is > > > > > executing as? > > > > > > > > On 3/12/08, Craig White <cr...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > > > > > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > > > > > > having a file saving permissions problem from within a controller... > > > > > > > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > > > > > > f.syswrite(output) > > > > > > > f.close > > > > > > > > > > The error... > > > > > > > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > > > > > > > this file path is not within RAILS path but rather outside of it. > > > > > > > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > > > > > > as user ''craig'' > > > > > > > > > > user ''craig'' clearly has permissions to save files in that path > > > > > > > (actually, the path is an NFS mounted path but I don''t see why that > > > > > > > should matter) > > > > > > > > > > Obviously I am missing some bit of information that would tell me why > > > > > > > this fails. > > > > > > > > > ---- > > > > > > OK - this is truly strange, because I can get it to work from > > > > > > script/console but not from within my controller...(I have removed the > > > > > > >> from the script/console output for readability). > > > > > > > > > @qm_book = QmManual.find(:all, \ > > > > > > :conditions => ["section = ?", "I/A"], \ > > > > > > :order => ''priority'') > > > > > > => [# Much data deleted... }>] > > > > > > File.open("I-A-files.txt", "w") do |file| > > > > > > for qm_book in @qm_book > > > > > > file.write "/home/path_to/New_QM_Manual/" + \ > > > > > > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > > > > > > if qm_book.no_of_pages.modulo(2) != 0 > > > > > > file.write \ > > > > > > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > > > > > > end > > > > > > end > > > > > > file.close > > > > > > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > > > > > > end > > > > > > => 1 > > > > > > > > > but this same code in my controller gets the error that I listed up top. > > > > > > > > > why would file write permissions differ from script/console and > > > > > > controller code? mongrel? mongrel is running as me - same user. > > > > > > > > > Craig > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On my development system, it''s disabled Craig On Fri, 2008-03-14 at 03:07 -0400, Mike Garey wrote:> is your machine running SELinux? I''ve run into some very strange > behaviour on my server machine which runs Redhat with SELinux enabled. > > Mike > > > On 3/13/08, Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > Doesn''t seem to be a chroot jail because I can save files on the out of > > the RAILS_ROOT tree but I had to symlink the NFS mount into my > > RAILS_ROOT to simplify the matter...it worked. I don''t know why and I > > had to move on. > > > > > > Craig > > > > > > On Thu, 2008-03-13 at 13:26 -0700, stuart.coyle wrote: > > > Maybe mongrel is running in a chroot jail? Have you checked what \ is > > > for it? > > > > > > On Mar 13, 12:14 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > > sort of solved anyway...I ended up making symbolic links from the target > > > > directory into a directory inside my RAILS_ROOT path and I can now save > > > > files, etc. > > > > > > > > this is strange behavior... > > > > > > > > Anyway, I wanted to leave tracks in case anyone follows down my path. > > > > > > > > Craig > > > > > > > > On Wed, 2008-03-12 at 14:02 -0700, Craig White wrote: > > > > > Good thought...I am just starting to tinker with backticks and executing > > > > > shell commands. > > > > > > > > > thus, in contoller code, flash[:notice] = `whoami` > > > > > > > > > just confirmed it is me, which I had to believe was the case since a > > > > > simple `ps aux |grep mongrel` also tells me the same thing. > > > > > > > > > The issue is somewhat confusing... > > > > > > > > > I am using various NFS mounts including my $HOME directory and I can > > > > > save files in that tree but not on other mounts. The curious thing is > > > > > that what works in script/console does not work in controller code so > > > > > I''m gathering that it has something to do with mongrel. > > > > > > > > > mongrel_cluster (1.0.2) > > > > > Mongrel plugin that provides commands and Capistrano tasks for > > > > > managing multiple Mongrel processes. > > > > > > > > > checking to see if there''s an update but I don''t hold out much hope for > > > > > it changing things > > > > > > > > > Craig > > > > > > > > > On Wed, 2008-03-12 at 16:46 -0400, Mike Garey wrote: > > > > > > are you absolutely sure mongrel is running as you? have you tried > > > > > > printing `whoami` from one of your controllers to see who your code is > > > > > > executing as? > > > > > > > > > > On 3/12/08, Craig White <cr...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > > > > > > > > > > On Tue, 2008-03-11 at 18:58 -0700, Craig White wrote: > > > > > > > > having a file saving permissions problem from within a controller... > > > > > > > > > > > > f = File.new("/home/path/to/I-A-files.txt", "w") > > > > > > > > f.syswrite(output) > > > > > > > > f.close > > > > > > > > > > > > The error... > > > > > > > > > > > > Errno::EACCES (Permission denied - /home/path/to/I-A-files.txt): > > > > > > > > > > > > this file path is not within RAILS path but rather outside of it. > > > > > > > > > > > > files saved without a path are clearly saved in the RAILS_ROOT directory > > > > > > > > as user ''craig'' > > > > > > > > > > > > user ''craig'' clearly has permissions to save files in that path > > > > > > > > (actually, the path is an NFS mounted path but I don''t see why that > > > > > > > > should matter) > > > > > > > > > > > > Obviously I am missing some bit of information that would tell me why > > > > > > > > this fails. > > > > > > > > > > > ---- > > > > > > > OK - this is truly strange, because I can get it to work from > > > > > > > script/console but not from within my controller...(I have removed the > > > > > > > >> from the script/console output for readability). > > > > > > > > > > > @qm_book = QmManual.find(:all, \ > > > > > > > :conditions => ["section = ?", "I/A"], \ > > > > > > > :order => ''priority'') > > > > > > > => [# Much data deleted... }>] > > > > > > > File.open("I-A-files.txt", "w") do |file| > > > > > > > for qm_book in @qm_book > > > > > > > file.write "/home/path_to/New_QM_Manual/" + \ > > > > > > > qm_book.section + "/" + qm_book.file_name + ".pdf" + "\n" > > > > > > > if qm_book.no_of_pages.modulo(2) != 0 > > > > > > > file.write \ > > > > > > > "/home/path/to/Build-PDF/blank-page.pdf" + "\n" > > > > > > > end > > > > > > > end > > > > > > > file.close > > > > > > > FileUtils.mv "I-A-files.txt", "/home/path/to/Build-PDF/" > > > > > > > end > > > > > > > => 1 > > > > > > > > > > > but this same code in my controller gets the error that I listed up top. > > > > > > > > > > > why would file write permissions differ from script/console and > > > > > > > controller code? mongrel? mongrel is running as me - same user. > > > > > > > > > > > Craig > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---