Is there a systematic way to deduct the cookbook, or even better the recipe, from a local resource (for instance /etc/hosts file)?
I can't think of a great way to do this out of the box on a live node. You could try something like piping `chef-client --why-run` output into grep to see what you can find. Since Chef isn't responsible for creating every file on your system, it's entirely possible that no resource interacted with a given file so it makes this sort of thing touch to gauge. Some alternative solutions you might look into though: