Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I restrict access from servlets to certain directories?

0
Posted

How do I restrict access from servlets to certain directories?

0

Location: http://www.jguru.com/faq/view.jsp?EID=505626 Created: Sep 27, 2001 Author: Richard Braun (http://www.jguru.com/guru/viewbio.jsp?EID=438832) Question originally posed by Bogdan Sheptunov PREMIUM (http://www.jguru.com/guru/viewbio.jsp?EID=310126 [ How can I only allow the servlets in a specific web application to access only regular Tomcat directories and the directory under /tomcat/webapps/? So far I found out that with the default Tomcat configuration (I am using 3.2.1), I am able to access every directory at my server (like File.canWrite() on “/” returns true).] It’s not that difficult. You can simply use the Java Security, provided you have Java 2. For example : grant { permission java.io.FilePermission “-“, “read,write”; } This only allows to read and write in the current directory and its sub-directories. Write this in your tomcat.policy file and then start tomcat like this : /path/to/java/bin/java -Djava.security.manager -Djava.security.policy=/path/to/tomc

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123