Spreading codes are the core of the spread spectrum transmission. In this paper, a novel channel-dependent code allocation procedure for enhancing security in multi-carrier code division multiple access (MC-CDMA) system is proposed and investigated over frequency-selective fading. The objective of the proposed technique is to assign the codes to every subcarrier of active/legitimate receivers (Rxs) based on their channel frequency response (CFR). By that, we ensure security for legitimate Rxs against eavesdropping while preserving mutual confidentiality between the legitimate Rxs themselves. To do so, two assigning modes; fixed assigning mode (FAM) and adaptive assigning mode (AAM), are exploited. The effect of the channel estimation error and the number of legitimate Rxs on the bit error rate (BER) performance is studied. The presented simulations show that AAM provides better security with a complexity trade-off compared to FAM. While the latter is more robust against the imperfection of channel estimation.