Tiny Core Linux

Tiny Core Base => CorePlus => Topic started by: malikawan on March 31, 2019, 10:19:43 PM

Title: I want to disable USB Drive
Post by: malikawan on March 31, 2019, 10:19:43 PM
I want to disable usb drive. When Tinycore login after that if any one plug usb drive it will never work.
Title: Re: I want to disable USB Drive
Post by: malikawan on April 02, 2019, 11:11:35 PM
Please any idea how to block usb storage.
Title: Re: I want to disable USB Drive
Post by: Juanito on April 03, 2019, 01: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.
Title: Re: I want to disable USB Drive
Post by: malikawan on April 03, 2019, 03: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.
Title: Re: I want to disable USB Drive
Post by: Juanito on April 03, 2019, 04:13:39 AM
Perhaps the problem is that usb-storage is compiled into the kernel rather than as a module
Title: Re: I want to disable USB Drive
Post by: Rich on April 03, 2019, 06: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.
Title: Re: I want to disable USB Drive
Post by: malikawan on April 04, 2019, 12: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
Title: Re: I want to disable USB Drive
Post by: Rich on April 04, 2019, 07: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.
Title: Re: I want to disable USB Drive
Post by: malikawan on April 04, 2019, 10:24:41 PM
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. 
Title: Re: I want to disable USB Drive
Post by: Rich on April 05, 2019, 05: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