A lock for universal serial bus (USB) ports has a shell, a tongue, a slide and a lock cylinder. The shell has a front end opening. The tongue is mounted securely in and protrudes out from the front end opening. The slide is mounted movably in the shell. The lock cylinder is mounted movably in the shell and selectively pushes the slide out of the front opening of the shell. The tongue is inserted in and engages the USB port. The lock cylinder pushes and secures the slide in the USB port under the tongue to lock the tongue in the USB port. Therefore, the USB port is locked and may not be used without permission.