Forum OpenACS CMS: permission denied

Posted by Philipp Strazny on
In making my first steps w/ the CMS I'm running into a file permission problem.

I've created a folder "subfolder1", and it contains a file "myFirstPage". When I try to publish this file (checking "live" & hitting "submit" in the "publishing" tab), I get the following error:
can't create directory "/subfolder1": permission denied
while executing
"file mkdir [string range $path 0 [expr $index - 1]]"
(procedure "mkdirs" line 11)
invoked from within
I inserted
puts $errorlog "pageroot used for mkdir: [ns_info pageroot]"
into the publish::mkdirs function in publish-procs.tcl to make sure the correct directory is being accessed, and it is: /web/openacs/www

The pageroot directory is owned by nsadmin.web; I start nsd w/
exec /opt/nsadmin/bin/nsd -u nsadmin -g web $*
and nsadmin belongs to group web.
The problem persists even if I chmod the pageroot to 777!

Can anybody think of what else I could check?

Posted by David Walker on
Just from your error description it looks to me like it's literally trying to create /subfolder1 instead of /web/openacs/www/subfolder1
Posted by Philipp Strazny on
Thanks, David.
That makes sense. I assumed that all files & folders created in the CMS would automatically be added under a legal (i.e. accessible for nsadmin) folder, namely the pageroot (www).

So, I created the path /web/openacs/www/subfolder2 and moved myFirstPage in there, and publishing worked.

Of course, I could only do that because I happen to know legal paths on the server. Other users would not. I suppose I could hardcode this path somewhere in publish-procs.tcl or add it as a parameter in the global config file (openacs.tcl). Or is there another way to tie the CMS to a legal directory?

Posted by Dan Wickstrom on
Your assumption that all folders and files created under cms should correspond to a valid file-system path is correct.  The PageRoot parameter sets the location where content is published.  If the PageRoot value doesn't start with a slash, then the PageRoot parameter is relative to [ns_info pageroot].  Currently something is broken with the way that opts(page_root) is initialized.  I tried modifying publish::publish_revision so that root path is set to the value returned by publish::get_page_root, and the publishing process worked fine.

I'm pressed for time now, but I'll try and track it down this week.

Posted by Philipp Strazny on
Thanks, Dan. The pageroot problem also has other side-effects: when I define a template that references an image, the CMS only recognizes the image as "existing" if the HTML tag includes a full path. The AOLServer, however, goes by pageroot (as it should) & thus would not find the image then.