WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: I want to disable USB Drive  (Read 6591 times)

Offline malikawan

  • Full Member
  • ***
  • Posts: 243
I want to disable USB Drive
« on: April 01, 2019, 01:19:43 AM »
I want to disable usb drive. When Tinycore login after that if any one plug usb drive it will never work.

Offline malikawan

  • Full Member
  • ***
  • Posts: 243
Re: I want to disable USB Drive
« Reply #1 on: April 03, 2019, 02:11:35 AM »
Please any idea how to block usb storage.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: I want to disable USB Drive
« Reply #2 on: April 03, 2019, 04:46:00 AM »
The second search hit for “linux block usb storage “ suggests “blacklist usb-storage”.

See the tinycore faq for how to use the blacklist boot code.

Offline malikawan

  • Full Member
  • ***
  • Posts: 243
Re: I want to disable USB Drive
« Reply #3 on: April 03, 2019, 06:09:11 AM »
Thanks for reply.

I have search but never found any code which block usb storage device. I also try suggested code blacklist=usb-storage but its also never work for me.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: I want to disable USB Drive
« Reply #4 on: April 03, 2019, 07:13:39 AM »
Perhaps the problem is that usb-storage is compiled into the kernel rather than as a module

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11635
Re: I want to disable USB Drive
« Reply #5 on: April 03, 2019, 09:08:37 AM »
Hi malikawan
Some ideas found from:
https://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt

Do you require any USB support? If not, the boot code:
Code: [Select]
usbcore.nousbshould disable the whole USB subsystem.

Or, try the following boot code set to 0
Code: [Select]
usbcore.authorized_default=
[USB] Default USB device authorization:
(default -1 = authorized except for wireless USB,
0 = not authorized, 1 = authorized)

If those don't work, try adding this to your  /opt/bootlocal.sh  file:
Code: [Select]
echo 3600 > /sys/module/usb_storage/parameters/delay_useNow if someone plugs in a USB device, it will take an hour before before it gets scanned and is usable.

Offline malikawan

  • Full Member
  • ***
  • Posts: 243
Re: I want to disable USB Drive
« Reply #6 on: April 04, 2019, 03:02:13 AM »
Hi Rich

Thanks the last one works like a charm

If those don't work, try adding this to your  /opt/bootlocal.sh  file:


echo 3600 > /sys/module/usb_storage/parameters/delay_use

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11635
Re: I want to disable USB Drive
« Reply #7 on: April 04, 2019, 10:42:27 AM »
Hi malikawan
You are welcome. Bear in mind that:
IF
  the user has access to a keyboard
AND
  has root access (sudo)
AND
  knows how you increased the USB detection delay
THEN
  they could undo the delayed USB detection.

It will however keep the average user out which is whom I presume you are targeting.

Offline malikawan

  • Full Member
  • ***
  • Posts: 243
Re: I want to disable USB Drive
« Reply #8 on: April 05, 2019, 01:24:41 AM »
Hi

When i plug usb and restart it will never add delay and is available to mount.  But when i unplug the usb and plug again then its not available. Means if user connect usb and start PC then it will be able to mount usb.

Any idea to remove usb if user attach at startup. 

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11635
Re: I want to disable USB Drive
« Reply #9 on: April 05, 2019, 08:55:56 AM »
Hi malikawan
We could try it as a kernel parameter instead so it occurs earlier. Try the boot code:
Code: [Select]
usb-storage.delay_use=3600