Online social networks have now become the most popular platforms for people to share information with others. Along with this, there is a serious threat to individuals’ privacy. One privacy risk comes from the sharing of co-owned data, i.e., when a user shares a data item that involves multiple users, some users’ privacy may be compromised, since different users generally have different opinions on who can access the data. How to design a collaborative management mechanism to deal with such a privacy issue has recently attracted much attention. In this paper, we propose a trust-based mechanism to realize collaborative privacy management. Basically, a user decides whether or not to post a data item based on the aggregated opinion of all involved users. The trust values between users are used to weight users’ opinions, and the values are updated according to users’ privacy loss. Moreover, the user can make a tradeoff between data sharing and privacy preserving by tuning the parameter of the proposed mechanism. We formulate the selecting of the parameter as a multi-armed bandit problem and apply the upper confidence bound policy to solve the problem. Simulation results demonstrate that the trust-based mechanism can encourage the user to be considerate of others’ privacy, and the proposed bandit approach can bring the user a high payoff.