How to Restirct a file by directly accessing

piyushmaheswari

Well-Known Member
Apr 18, 2020
74
2
8
India
cPanel Access Level
Root Administrator
Sir hello , I made a custom command for viewing uptime on Linux server.
curl -Lso- https://mydomain/cmds/uptime.sh | bash

sir I want to know that how can I restrict this uptime.sh file by directly viewing or downloading but can download through only command ?

Like some one open https://mydomain/cmds/uptime.sh then their browser downloads uptime.sh file .
but I don't want that anyone can view or download file directly.
like if someone opens https://mydomain/cmds/uptime.sh then they will see access denied but if they run command curl -Lso- https://mydomain/cmds/uptime.sh | bash
Then they will get output.
Please tell.
 
Last edited:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
Not sure how you restrict it by a specific command if it's listed in the domain's document root - you could restrict that cmds folder to specific IP addresses though using an .htaccess block. You might also check user-agent blocks and block any other user agents that may request the file.