A cap for medical fluid lines and the like includes a hollow body within which a male or female connector accessible at one end of the body is coaxially housed. The connector is configured to inviolably obstruct the passage through the body. A unidirectional coupling locks in rotation the connector with respect to the body in the direction corresponding to the screwing of the connector, and a complementary connector, and to enable free rotation of the connector in the opposite direction. The connector can be possibly locked in rotation with respect to the body in the unscrewing direction, only following a positive command.