This paper presents SORT (Self-Organizing Trust), a model for building trust relationships among peers in peer-to-peer (P2P) systems. SORT uses local information from past interactions and recommendations to help peers assess the trustworthiness of other peers in their proximity. It defines two contexts to measure trust - service context for service provision and recommendation context for recommendation trustworthiness. Peers develop their own local views of trust rather than trying to collect global information. Simulation experiments show SORT can help isolate malicious peers and mitigate various attack behaviors in P2P file sharing.