In this paper, a novel physical layer security technique is presented for indoor visible light communications (VLC) systems based on optical spatial shift keying (OSSK). Transmitters are equipped with light emitting diode (LED) arrays and in OSSK information is carried only by the LED indices rather than the transmitted symbols themselves. Assuming that the source has the channel state information (CSI) of the optical channel gains between the LEDs and a legitimate user, a pre-equalizer is designed for the transmitter, which transforms the actual channel gains into a new channel realization in which equalized channel coefficients are widely apart from each other in multiple LED fixtures within the power constraint. Since the eavesdropper's channel is not equalized, its bit error rate performance is profoundly degraded. In addition, it is shown that the proposed technique does not need to have the CSI of the eavesdropper. Also an analytical expression is derived to evaluate the capacity of OSSK exactly from which the achievable secrecy capacity of the proposed scheme is obtained easily by computer simulations. In the computer simulations, the channels for different scenarios are generated by Zemax, which is an optical design software with ray-tracing capabilities. Simulation results show that, as excellent bit error rate (BER) performance is achieved by the legitimate user, the performance of the eavesdropper degrades to a level that it is not possible to receive any meaningful information.