0

I have a uploader using applet and jsp,so after it is uploaded the owner is tomcat so it is not accessible by php i mean apache. its throughs error.i changed chown in php and directly in shell access. still i ant access that directory through php. please check my image.

Elamurugan
  • 137
  • 7

2 Answers2

0

The directories leading to the file would have to be executable and the file would need to be readable, as the user that is attempting to use it.

If you want more specific details, please provide the permissions on all leading directories as well as the file and the user Apache is running as.

Warner
  • 23,440
  • 2
  • 57
  • 69
  • Please can you explain me bit more,
    i am confused. am sorry.
    this is what i need to do, the directories and files will be created by tomcat user/group and whem am trying to access it from php it does not reachable.
    Show me some ways to change the user groups or how to access the tomcat user directories from apache user/group. thanks
    – Elamurugan Apr 02 '10 at 05:57
0

chown the directory to the tomcat user and user's group (I'm assuming its tomcat):

chown tomcat:tomcat /some/direcotry

Then set the setgid bit as well as read and execute permissions

chmod 2555 /some/directory

Setting the setgid bit will cause all new files and directories created within /some/directory to inherit the group ownership of "tomcat".

You'll need to give permissions to the existing files:

chown -R tomcat:tomcat /some/directory/
chmod 555 /some/directory/

Keep in mind that we're making these files world-readable and world-executable to cover the apache user who does not belong to the tomcat group. A better solution would be to modify your apache user / httpd.conf to belong to the tomcat group as a secondary group and modify the permissions as 2550 and 550 to prevent the files from being readable and executable by anyone on the system.

Brian Tillman
  • 673
  • 3
  • 5
  • Yes i do understand and the risk. am trying to add apache user to the tomcat user group so that apache can able to read and write the directories that are created by tomcat. To be clearly the directories and files will be created by tomcat user/group and whem am trying to access it from php it does not reachable. i did umask changes to 0022 i dont know hether that is correct or not. Please tell me where i am wrong. I am unable to run this also from php because its in apache user and group so it is not running in the tomcat user group. – Elamurugan Apr 02 '10 at 05:29
  • chown -R ss4udemo /var/www/vhosts/site.com/httpdocs/public/uploads/Toy_Story_695303/ chgrp -R apache /var/www/vhosts/site.com/httpdocs/public/uploads/Toy_Story_695303/ mkdir -m 777 /opt/adobe/fms/applications/vod/media/Toy_Story_695303/ mkdir -m 777 /opt/adobe/fms/applications/vod/media/Toy_Story_695303/converted mkdir -m 777 /opt/adobe/fms/applications/vod/media/Toy_Story_695303/HQ – Elamurugan Apr 02 '10 at 05:30
  • chmod -R 2777 uploads/ chown -R apache:apache uploads/ I did these two commands but still the files under this directory created by tomcat is still tomcat:tomcat – Elamurugan Apr 02 '10 at 05:37