Since there is no method to verify the trustworthiness of shared files in P2P file sharing systems, malicious peers can spread untrustworthy files to the system. In order to prevent untrustworthy files from spreading, we propose an effective trust management scheme using peer reputation and file reputation together in a DHT-based structured P2P systems. Simulation results show that the proposed scheme effectively restrains the spreading of untrustworthy files even in cases where malicious peers change their identities. Simulation results show that the overall message cost for managing trust data is relatively low. We also propose a replication scheme so as to avoid the loss or corruption of trust data.