This tutorial shows how to disable your laptop’s built-in webcam in Ubuntu 24.04, Ubuntu 22.04, Ubuntu 20.04, and Ubuntu 18.04.
If you rarely use the webcam in your laptop, then it’s a good choice to disable it for privacy and security reasons. Some laptops have physical buttons to do the job, but most others do NOT.
Besides covering your webcam with a sticky note, here’s how to configure your Ubuntu to soft-block using Kernel module option.
Option 1: Disable Only Internal Laptop Webcam
If you want to disable the internal laptop webcam, and use the one attached via USB, then you may create a udev rule to auto-remove the device as soon as it is detected.
1. First, press Ctrl+Alt+T
on keyboard to open up a terminal window. When it opens, run command to find out the ID of your webcam device:
lsusb
In the terminal output, identify the device according to the text description. Then, copy the ID xxxx:xxxx (5986:2113 in my case).
- The 4 hexadecimal numbers before colon is the Vendor ID.
- While the 4 after is the Product ID.
2. Once you got the ID, run the command below to create (and edit) a udev rule config file:
sudo nano /etc/udev/rules.d/40-disable-internal-webcam.rules
When file opens, add the line below but replace the ID to yours!
ACTION=="add", ATTR{idVendor}=="5986", ATTR{idProduct}=="2113", RUN="/bin/sh -c 'echo 1 >/sys/\$devpath/remove'"
After editing, press Ctrl+S to save changes and Ctrl+X to exit.
3. Finally, restart your computer! You’ll see that lsusb
command no longer find the webcam device, and camera app reports “No Device Found”.
Option 2: Disable the Kernel Module for Webcam
If you want to disable webcam completely in Ubuntu, just un-load and block the Linux USB Video Class (UVC) driver.
Disable uvcvideo Module Temporarily
You can disable your webcam device to prevent it from working temporarily by un-load the Kernel module.
To do so, simply open up a terminal window, and run command:
sudo modprobe --remove uvcvideo
Your webcam will stop working immediately, until system reboot or manually re-load the kernel module.
At any time, you may re-load the module to make the webcam work again, by running command:
sudo modprobe uvcvideo
To permanently disable webcam in Ubuntu:
To permanently disable the webcam, simply add the rule to block the kernel module on every boot.
To do so, open terminal (Ctrl+Alt+T) and run command to edit the configuration file:
sudo nano /etc/modprobe.d/blacklist.conf
When the file opens, add two new lines below:
#Disable webcam blacklist uvcvideo
Finally, press Ctrl+S to save and Ctrl+X to exit. You Ubuntu will read the file and block the driver next time you boot the system.
Summary
In this tutorial, I’ve shown you how to disable webcam for your laptop in Ubuntu Linux.
To disable internal laptop webcam, while allowing the one attached via USB, you may add a udev rule to tell to auto-remove the built-in device as soon as it is detected on system boot.
To disable webcam completely, you may either un-load the Kernel driver that works until reboot, or add a rule to block loading that driver on every boot.
or put a sticker over it ;)
To “temporarily” or “permanently” disable the web cam in one function, not very sophisticated but certainly “simple” and “flexible”, is to put a piece of masking tape on the camera lens. I chose black to match my laptop. :-) Cheers!
how do I enable it again
“To revert the changes, simply remove the 2 lines, save the file and finally reboot.” read all
thanks ;)
You do not need to reboot to reactivate it.
simply type:
sudo modprobe uvcvideo
And the camera is reactivated