Search code examples
cachingofflineipfs

How to use IPFS without providing online access for specific folders and files?


IPFS provides useful caching mechanism. My goal is to use IPFS caching mechanism without providing an online access.

Even I do not share the ipfs-hash of the file with other users, I want to disable probability for other users to access/pull that file I stored on my local IPFS directory, somehow if they find out the ipfs-hash of the file/folder.

=> If I don't run ipfs daemon would it be a solution? If yes, the problem is for some files I may need to use ipfs daemon to share them with other users or I also may need to pull files from other nodes. The problem rises that when I start running ipfs daemon this will enable access to all the files that is stored on the local ipfs folder.

[Q] So basically I want to use IPFS as a offline caching tool and do not provide outside access for some specific folders that I store in IPFS. Even ipfs daemon was running, could I disable online access for specific files/folders that I decide?

For example, I have multiple folders and I want to store them under local IPFS folder, where who ever has their ipfs-hash will not be get able to pull those files. Even ipfs daemon is running could I force those folders that is stored in local IPFS folder to have no outside access? and provide online access for some other folders.


As a solution, on my machine could I run two different IPFS processes having different local repository. First one is open to outside and can pull from other nodes etc. (running ipfs daemon); but other does not have any access to outside and no-one can access to its files.


Solution

  • In addition to the offline mode mentioned by Victor Bjelkholm, you can look into setting up a private swarm. For instructions, see https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#private-networks

    That way you have a node that can be connected to other nodes of yours with the same swarm key, it is absolutely impossible for this node to intentionally or accidentally connect to the public IPFS network.