A cooperative structured peer-to-peer file-sharing system requires that the nodes participating in the system need to maintain the location mappings of other nodes. However, the selfish nodes have no incentive to donate their own resources to other nodes and they will refuse to take the responsibility for the maintenance of location mappings, if they can get the system’s resources for free. Thus, this free-riding behavior of selfish nodes will make many files unavailable to the whole system. To address this problem, we propose a robust distributed system to monitor the activities of each node and evaluate the node’s reputation, which influences the node’s access to the system resources. We analyze the system and demonstrate that it is scalable and is secure under a strong attack model. Furthermore, simulation results show that the system can detect and prevent the freeriding behavior effectively and efficiently.