Jump to content

Recommended Posts

Posted

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.

 

Posted

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.

Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...