Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to disable USB Storage on Linux system

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to disable USB storage in the Linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

In order to protect the security of data in enterprises, software and hardware firewalls are usually used to restrict external unauthorized access, but it is difficult to guard against thieves. In order to eliminate internal data leakage, USB storage devices are usually disabled.

Method 1 pseudo installation

In this method, we add a line of install usb-storage / bin/true to the configuration file, which makes the operation of installing the usb-storage module actually run / bin/true, which is why this method is called pseudo-installation. Specifically, create and open a file named block_usb.conf (possibly by another name) in the folder / etc/modprobe.d

$sudo vim / etc/modprobe.d/block_usb.conf

Then add the following line:

Install usb-storage / bin/true

Finally save the file and exit.

Method 2 remove the USB driver

This method requires us to delete or remove the driver (usb_storage.ko) stored in USB, so that the USB storage device can no longer be accessed. Execute the following command to remove the driver from its default location:

$sudo mv / lib/modules/$ (uname-r) / kernel/drivers/usb/storage/usb-storage.ko / home/user1

The driver can no longer be found in the default location, so when the USB memory is connected to the system, it cannot be loaded into the driver, causing the disk to become unavailable. But there is a small problem with this approach, which is that when the system kernel is updated, the usb-storage module will reappear in its default location.

Method 3-blacklist USB memory

We can also blacklist usb-storage through the / etc/modprobe.d/blacklist.conf file. This file is readily available on RHEL/CentOS 6, but you may need to create it yourself on 7. To blacklist USB storage, open / create the above file using vim:

$sudo vim / etc/modprobe.d/blacklist.conf

And enter the following line to blacklist USB:

Blacklist usb-storage

Save the file and exit. Usb-storage will be blocked from loading by the system right away, but this method has a big disadvantage that any privileged user can load the usb-storage module by executing the following command

$sudo modprobe usb-storage

This problem makes this approach less ideal, but it works well for non-privileged users.

Restart the system after the changes are complete for the changes to take effect.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

After reading the above, do you have any further understanding of how to disable USB storage on the Linux system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 251

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report