rejetto forum

Any way to limit viewing a folder/file from one specific IP?

Tsuna · 6 · 3592

0 Members and 1 Guest are viewing this topic.

Offline Tsuna

  • Occasional poster
  • *
    • Posts: 13
    • View Profile
Using the latest dev version and having a roadblock where I want to limit a folder such that only a specific IP can view it/access it
But unable to find anything like this in the docs or on the forum

I think it may be possible via a script for that folder? Looking for some guidance on the same


Offline NaitLee

  • Tireless poster
  • ****
    • Posts: 203
  • Computer-brain boy
    • View Profile
Right click on your folder, select "Properties...", then go to "Diff template" tab, put in these:
Code: [Select]
[^]
{.if|{.!=|%ip%|192.168.2.149.}|
{:{.disconnect.}:}
.}
(replace the ip to yours)

Push OK then it works ;)
"Computation is not forbidden magic."
Takeback Template | PHFS



Offline Tsuna

  • Occasional poster
  • *
    • Posts: 13
    • View Profile
Not working. REEEEEEE

I want that the file can be only accessed by a specific IP I want.

like a folder's file can be accessed through 1.1.1.1 nor can access the file.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
if only one particular ip should be able to access the folder, add something similar in the diff template of the folder properties

either by using a forced disconnection
Code: [Select]
[+]
{.if|{.=|%ip%|127.0.0.1.}|{:{.disconnect.}:}.}

or even better by using a redirect which gives the user the impression of an invalid link

Code: [Select]
[+]
{.if|{.=|%ip%|127.0.0.1.}|{:{.redirect|../ .}:}.}


replace 127.0.0.1 by the allowed ip


a more concrete example is to only give access to a specific user without going through permissions

Code: [Select]
[+]
{.if|{.!=|%user%|Tsuna.}|{:{.redirect|../ .}:}.}


note the difference in use between  {.!=|    and  {.=|  , difference or equal usage
« Last Edit: April 28, 2021, 07:18:43 PM by Mars »


Offline danny

  • Tireless poster
  • ****
    • Posts: 281
    • View Profile
...the file can be only accessed by a specific IP...
At HFS console, press alt+f6 to edit events file, and add this:
Code: [Select]
[download]
{.if|{.match|myparticularfile.doc|%url%.}|{:{.if|{.!=|%ip%|127.0.0.1.}|{:{.disconnect.}:}.}:}.}
replace  myparticularfile.doc  with target file name (to block for most)
replace  127.0.0.1  with target IP address (to allow for one)

P.S. Other options instead of  myparticularfile.doc may be /folder* or *.doc and you can even add to the list, such as myparticularfile.doc;myotherfile.txt;*.pdf with semicolon in-between. 

P.P.S. If this method seems clunky, then you could use the more normal and flexible users/groups/passwords, located in hfs menu > other options > user accounts.  And, then you can right-click on a particular folder/file to set it private to your users/groups. 
« Last Edit: April 30, 2021, 02:29:40 PM by danny »