| |

VerySource

 Forgot password?
 Register
Search
View: 898|Reply: 6

How to prevent others from seeing the files in the directory ???

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-16 15:30:01
| Show all posts |Read mode
I recently completed a project, the web server is Tomcat, and most of it has been completed. But there is a problem that everyone needs to solve!

  For example: You can access the homepage through the address http: // localhost / bbs, but if someone knows one of the directories on my website (such as the Test directory), they can see me directly at http: // localhost / bbs / Test All Jsp files in the Test directory, how to prevent this from happening ?????????
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-17 11:30:01
| Show all posts
Does anyone know, if you know there is a solution to this kind of book, you can also tell, thank you!!!
Reply

Use magic Report

0

Threads

12

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-27 16:30:01
| Show all posts
The files used inside the server can be placed in the web-inf directory, shielded from the outside world
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-7 19:30:01
| Show all posts
method 1:
Modify TomcatHome\conf\web.xml
...
<servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>
          org.apache.catalina.servlets.DefaultServlet
        </servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value> -> true here is changed to false
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
...

Save -> Restart OK!
Method 2:
Put an index.jsp or index.html content under your default test directory can be empty This is relatively simple
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-9 22:15:01
| Show all posts
Positive solution upstairs!
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 United States

 Author| Post time: 2020-8-17 17:45:01
| Show all posts
Thank youmjs5938
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-17 18:00:01
| Show all posts
The easiest way:
    You also know that others cannot directly access the files under your WEB-INF. You can put the things you don’t want others to access directly under WEB-INF, but you have to modify all the submission directories and see your project. It's over, it's probably not suitable, you can try it later.
The second method:
    You can do some processing in the filter, such as: not logged in and then return.

If you are a Struts architecture, you can override the RequestProcess class and do some processing.

The dumbest way:
    You can make judgments on every page.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list