How can I disable my webcam?

Cameras are controlled by the uvcvideo kernel module.

You can disable the camera until reboot by opening a terminal and typing sudo modprobe -r uvcvideo. You will be asked for your password, and after typing it, if there are no errors shown in the terminal, your webcam should be disabled.

If you got the error message: modprobe: FATAL: Module uvcvideo is in use. after trying to remove the uvcvideo module, you can try to force its removal with the following: sudo rmmod -f uvcvideo (thanks thiagowfx)

To enable your webcam again, type sudo modprobe uvcvideo into terminal.

If you want the camera to be disabled when you reboot, then press ALT+F2 and paste this command:

gksu gedit /etc/modprobe.d/blacklist.conf

You will be asked for your password. After giving it, a text file should open. Paste at the end of the text file on a new line:

blacklist uvcvideo

Then save the file and exit. Next time you start Ubuntu, the webcam should be disabled.


Run:

# pre ubuntu 18.04
gksu gedit /etc/modprobe.d/blacklist.conf

# --- OR ---

# ubuntu 18.04 and later
gedit admin:///etc/modprobe.d/blacklist.conf

Add

blacklist uvcvideo

at the bottom. Save the file and quit the text editor.

Regarding the comment:

Find the vendor and device id for the webcam with lsusb:

Bus 001 Device 002: ID 05a9:2640 OmniVision Technologies, Inc. OV2640 Webcam

Next ...

cd /sys/bus/usb/devices/
ls 

Do a "grep" on the vendor id and product id:

$ grep 05a9 */idVendor
1-1/idVendor:05a9

$ grep 2640 */idProduct
1-1/idProduct:2640

and 1-1 is what you need. cd into 1-1.

The file bConfigurationValue in this directory needs to contain a 0 to disable the device or a 1 to enable it. But this file is owned by root so to alter it (change the 0 to a 1 to enable) ...

 sudo -i
 echo 0 > bConfigurationValue

to disable. You can check the camera and it will be disabled.

This is not permanent yet. A reboot will set it back to what is was before. To make it permanent:

 sudo -i
 echo 0 > /sys/bus/usb/devices/1-1/bConfigurationValue

(where 1-1 is the directory we used and use a 1 to enable)


How about just taping it with some black colored tape? Take some black tape and put it on the webcam. Webcam disabled successfully! Unlike the answers above, this method works against malware attacks that try to enable your webcam as well!

Tags:

Webcam