Jump to content

I Can't Create Directory Or File Using Jsp Script.


vaninf

Recommended Posts

I have a JSP file mkdir.jsp in folder /home/vaninf/public_html/, it tries to create a directory and file, but I get "Permission denied" exception.

 

How can I create a directory or file using JSP script? How can I get the permission to do it?

 

Thanks.

 

Link to comment
Share on other sites

The user that Tomcat runs as doesn't have permission to create directories for security because this is a shared host. Just create your folder manually, or create it with PHP. PHP is allowed to create directories because it runs as SuPHP which means it runs with the same permissions as your main user account. There is no such thing as SuJSP so Tomcat has to run all users with the same tomcat user with the same permissions.

Link to comment
Share on other sites

My JSP web application will allow users to upload image files, so my JSP scripts has to be able to create directories and files. I searched internet and find this site: https://stackoverflow.com/questions/35428172/tomcat-permission-denied-when-trying-to-write-a-file

 

Can you run these two commands:

chown tomcat:tomcat /home/vaninf/public_html

chmod u+wrx /home/vaninf/public_html

so that my JSP scripts can create folders and files in my home folder.

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...