70

I have an integrated webcam in my laptop. I know that it works and that ubuntu recognized it because at installation it asked if I wanted a photo taken for some kind of image associated with my account. When I look in system settings, I do not see any webcam in the hardware section. I would like to disable the webcam like you can do in Windows, but as I can't find it in my hardware section, how can I disable it? I cannot even unplug it as it is integrated into the monitor. Am I looking in the wrong place?? I am using 12.04

2
  • You do not see the webcam in the hardware section? Where are you looking at? What is the output of the lsusb command?
    – jap1968
    Jul 22, 2012 at 19:24
  • 6
    In case you want to do this for security reasons, consider disabling the webcam in the system's BIOS settings as disabling it in software won't stop an attacker to re-enable it.
    – gertvdijk
    Dec 24, 2013 at 19:00

4 Answers 4

65

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.

7
  • 2
    Much better comment. Thanks for letting me know how to disable right away, and mentioning restart required! Aug 14, 2013 at 14:29
  • Thanks for the complete answer! I would like to add the following: if you got the error message: modprobe: FATAL: Module uvcvideo is in use. after trying to remove the uvcvideo module, you could try to force its removal with the following: sudo rmmod -f uvcvideo.
    – thiagowfx
    Dec 1, 2013 at 21:12
  • Thank you, I want to bind to Fn+Esc a script that enable/disable camera and microphone, and this is what I need to know. Sep 30, 2014 at 13:32
  • 2
    I know this answer is from 2012, but it is one of the top results on google and I don't have the reputation to answer here: gksu doesn't seem to be in Ubuntu 18 anymore, you just have to do sudo gedit /etc/modprobe.d/blacklist.conf and add blacklist uvcvideo
    – Fels
    Aug 3, 2018 at 9:12
  • Changing that file in Ubuntu 18.04 significantly slows down startup.
    – NelsonGon
    Jun 20, 2019 at 15:23
50

How to disable all webcams:

  1. Run (for pre ubuntu 18.04):
gksu gedit /etc/modprobe.d/blacklist.conf

Or run (for ubuntu 18.04 and later):

gedit admin:///etc/modprobe.d/blacklist.conf
  1. Then add...
blacklist uvcvideo

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

How to disable a single webcam:

  1. Find your webcam with lsusb. My output:
Bus 002 Device 002: ID 0bda:0328 Realtek Semiconductor Corp.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2b Intel Corp.
Bus 001 Device 002: ID 0bda:568c Realtek Semiconductor Corp.
Bus 001 Device 042: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

If it isn't clear which device is your webcam, you can try lsusb -t and look for Class=Video or Driver=uvcvideo or similar to guess which one it is. My output:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 4: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 2: Dev 42, If 2, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 2: Dev 42, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 2: Dev 42, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 5: Dev 2, If 1, Class=Video, Driver=uvcvideo, 480M
    |__ Port 5: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 7: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 7: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
  1. Next, find the vendor id and device id from the output of lsusb surrounding the colon:
Bus 001 Device 002: ID 0bda:568c Realtek Semiconductor Corp.

So in my case, the vendor id is 0bda and the product id is 568c.

  1. Next go to:
cd /sys/bus/usb/devices/
  1. To find the correct directory do a grep there with the product id and if you get multiple results then also with the vendor id:
grep 568c */idProduct

returned:

1-5/idProduct:568c

and

grep 0bda */idVendor

returned:

1-5/idVendor:0bda
2-4/idVendor:0bda

In my case 1-5 is what I need.

  1. cd into the directory from the previous step.

  2. 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) ...

echo 0 | sudo tee bConfigurationValue

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

  1. This is not permanent yet. A reboot will set it back to what it was before. To make it permanent:
echo 0 | sudo tee /sys/bus/usb/devices/1-5/bConfigurationValue

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

5
  • 3
    This disables all webcams. The OP states that "I would like to disable the webcam like you can do in Windows..." Windows (through the Device Manager) enables individual devices to be disabled and not an entire class of devices. It would be helpful if this answer was expanded to include instructions for disabling a specific webcam. Dec 24, 2015 at 8:14
  • "like you can do in Windows..." Windows (through the Device Manager)" I am expected to know what windows does? >:-D Is this sufficient?
    – Rinzwind
    Dec 24, 2015 at 9:41
  • Oh yes, that's much better :) Dec 24, 2015 at 19:44
  • Dear Rinzwind, would something like `# chmod a-r /dev/video0' work? just guessing!
    – Maxim
    May 4, 2020 at 0:08
  • yes but ONLY until you reboot. You are better of removing the user from the group video0 is set too. and there could also be a video1 or video2 if you have more camera's. Put some tape over the camera is a 100% foolproof trick ;) Or disabling it in BIOS if possible
    – Rinzwind
    May 4, 2020 at 4:35
43

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!

4
  • 7
    This is actually a plausible solution and fool-proof.
    – Braiam
    Dec 24, 2013 at 19:35
  • @Gracchus Hmm. Transparent aluminum? Has that been invented yet? A hole in every hole! :P
    – Seth
    Jan 26, 2014 at 2:12
  • Tape the microphone as well.
    – Barun
    Aug 4, 2019 at 16:32
  • Well, no malware on Linux, but this solution is the best! no typing :))
    – Maxim
    May 4, 2020 at 0:07
2

I had luck with going into the BIOS for my laptop (Dell XPS 15 9570), where there was an option to disable the built-in webcam and microphone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .