Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I used cpanel+tomcat .the Project structure is :

ROOT

 ----index.jsp

 ---- sample.txt

 ----- /WEB-INF/classes/pack2/sample2.txt

tomcat Can write into sample.txt with permission 664 . but cannot write into /WEB-INF/classes/pack2/sample2.txt

/WEB-INF/classes/pack2/ with permission 775 , sample2.txt with permission 775 . all folder and files in web-inf folder contains permission 775 and the owner of files is Ftp user .

permissions are:

root@panther [/home/domain /public_html]# ls -la

total 15884

drwxr-x--- 4 domain nobody 4096 Jan 9 19:10 ./

drwx--x--x 11 domain domain 4096 Jan 28 12:06 ../

-rw-r--r-- 1 domain domain 0 Oct 2 14:44 .htaccess

drwxr-xr-x 5 domain domain 4096 Oct 8 19:26 ROOT/

-rw-r--r-- 1 domain domain 16216478 Jan 9 19:10 ROOT.zip

For all files Owner,Group is domain. domain is ftp user. tomcat is member of nobody group.

share|improve this question
1  
And tomcat is running as? –  Nils Jan 28 '12 at 20:41
    
As Nils pointed out, we need to know the owner and group of the directories in question, as well as what user tomcat is running as and what groups the tomcat user is in. –  James Polley Jan 29 '12 at 12:46
add comment

1 Answer

You haven't provided enough information for a definitive answer; but what you have provided is enough for me to take a stab. I'm going to assume that the problem lies outside of tomcat, in the filesystem permissions - but it's also possible that tomcat, or your application, has some other config that limits what locations on the filesystem it will let itself write to.

You mentioned that all the folders are 775 - that's rwx for the onwer, rwx for the owning group, and read and execute for everyone else.

You've mentioned that the problem is that tomcat (and by implication, the user running tomcat) can't create files inside /WEB-INF/classes/pack2/

If the user running tomcat was the owner of the directory, they'd be able to create files in that directory - so it must be a running as a different user

If the user running tomcat is in the group that owns the directory, the permissions are sufficient that they should still have the ability to create files - so we can deduce that the user running tomcat is also not in the group that owns the directory

So, the only remaining possibility is that the user running tomcat is neither the user that owns the directory or a member of the group owning the directory - or there's something weird going on.

One way to make this problem go away would be to make the folder 777 - but I'm not going to call that a "solution" as it leaves the system wide open for abuse, as anyone can write there. Another way would be to add the user running tomcat into the group that owns the directory; but I don't know what that group is, so I don't know if that's going to be an appropriate solution or not.

Another way is to make a new group just to control access to this folder; use chgrp to change the group owner of the folder to the new group, and add anyone who needs write access to the folder into that group.

share|improve this answer
    
hi,send the all permissions . please check and answer me . thank you . –  amir2 taghvaei Jan 30 '12 at 7:40
    
I see that you've added details, but they just confirm what I've already said. You've said that the tomcat user is only in group nobody, but the files are owned by domain:domain. You need to either add the tomcat user into the domain group; or chgrp the files and folders to the tomcat user's group. –  James Polley Jan 30 '12 at 7:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.