统信UOS/麒麟KYLINOS禁用USB存储
  qkadZYAX5eto 2023年11月19日 25 0

原文链接:统信UOS/麒麟KYLINOS禁用USB存储

hello,大家好啊,今天给大家带来一篇在统信UOS/麒麟KYLINOS禁用USB存储的文章,文章通过三种方式:1、在文件管理器中通过图形化方式移除USB;2、通过禁用USB存储模块实现禁用;3、通过添加udev规则实现禁用。大家可以选择不同的方式实现,欢迎大家分享转发。关注我吧!

1、查看系统版本

pdsyw@pdsyw-PC:~/Desktop$ cat /etc/os-version 
[Version] 
SystemName=UOS Desktop
SystemName[zh_CN]=统信桌面操作系统
ProductType=Desktop
ProductType[zh_CN]=桌面
EditionName=Professional
EditionName[zh_CN]=专业版
MajorVersion=20
MinorVersion=1060
OsBuild=11014.100.100
pdsyw@pdsyw-PC:~/Desktop$ 
pdsyw@pdsyw-PC:~/Desktop$ uname -a
Linux pdsyw-PC 4.19.0-arm64-desktop #6030 SMP Tue Jun 27 15:28:10 CST 2023 aarch64 GNU/Linux
pdsyw@pdsyw-PC:~/Desktop$

统信UOS/麒麟KYLINOS禁用USB存储_Desktop

2、查看USB存储信息

pdsyw@pdsyw-PC:~/Desktop$ lsmod | grep usb_storage
usb_storage            73728  1
pdsyw@pdsyw-PC:~/Desktop$

统信UOS/麒麟KYLINOS禁用USB存储_重启_02

3、可以通过卸载按键进行卸载

统信UOS/麒麟KYLINOS禁用USB存储_Desktop_03

4、也可以点击安全移除按键进行移除

统信UOS/麒麟KYLINOS禁用USB存储_desktop_04

5、可以通过命令行卸载移除USB

pdsyw@pdsyw-PC:~/Desktop$ sudo rmmod usb_storage

统信UOS/麒麟KYLINOS禁用USB存储_desktop_05

6、移除后查看USB信息

pdsyw@pdsyw-PC:~/Desktop$ lsmod | grep usb_storage
usb_storage            73728  0
pdsyw@pdsyw-PC:~/Desktop$

统信UOS/麒麟KYLINOS禁用USB存储_uos_06

7、通过禁用usb存储模块实现禁用USB存储

pdsyw@pdsyw-PC:~/Desktop$ sudo -i
root@pdsyw-PC:~# echo "install usb-storage /bin/true" > /etc/modprobe.d/usb-storage.conf
root@pdsyw-PC:~# chmod 644  /etc/modprobe.d/usb-storage.conf
root@pdsyw-PC:~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.19.0-arm64-desktop
cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries 
    nor crypto modules. If that's on purpose, you may want to uninstall the 
    'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs 
    integration and avoid this warning.
setupcon is missing. Please install the 'console-setup' package.
W: plymouth: The plugin label.so is missing, the selected theme might not work as expected.
W: plymouth: You might want to install the plymouth-themes package to fix this.
I: The initramfs will attempt to resume from /dev/sda3
I: (UUID=9aaca392-458c-4f32-925b-04692d3f9a43)
I: Set the RESUME variable to override this.
live-boot: core filesystems devices utils udev blockdev dns.
Adding IMA binaries
root@pdsyw-PC:~# reboot

统信UOS/麒麟KYLINOS禁用USB存储_linux_07

8、重新插入u盘已经无法识别

统信UOS/麒麟KYLINOS禁用USB存储_desktop_08

9、通过删除usb-storage.conf文件取消USB存储禁用

pdsyw@pdsyw-PC:~/Desktop$ sudo rm -rf /etc/modprobe.d/usb-storage.conf 
pdsyw@pdsyw-PC:~/Desktop$ 
pdsyw@pdsyw-PC:~/Desktop$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.19.0-arm64-desktop
cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries 
    nor crypto modules. If that's on purpose, you may want to uninstall the 
    'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs 
    integration and avoid this warning.
setupcon is missing. Please install the 'console-setup' package.
W: plymouth: The plugin label.so is missing, the selected theme might not work as expected.
W: plymouth: You might want to install the plymouth-themes package to fix this.
I: The initramfs will attempt to resume from /dev/sda3
I: (UUID=9aaca392-458c-4f32-925b-04692d3f9a43)
I: Set the RESUME variable to override this.
live-boot: core filesystems devices utils udev blockdev dns.
Adding IMA binaries
pdsyw@pdsyw-PC:~/Desktop$ reboot

统信UOS/麒麟KYLINOS禁用USB存储_Desktop_09

10、取消禁用重启后可以识别USB存储

统信UOS/麒麟KYLINOS禁用USB存储_Desktop_10

11、通过添加udev规则实现禁用usb存储

pdsyw@pdsyw-PC:~/Desktop$ sudo vi /etc/udev/rules.d/10-usb-block.rules
请输入密码:
验证成功
pdsyw@pdsyw-PC:~/Desktop$ cat /etc/udev/rules.d/10-usb-block.rules
ACTION=="add", KERNEL=="sd[a-z][0-9]*", SUBSYSTEM=="block", RUN+="/bin/sh -c 'echo 0 > /sys/block/%k/device/authorized'"

pdsyw@pdsyw-PC:~/Desktop$ reboot

统信UOS/麒麟KYLINOS禁用USB存储_desktop_11

12、重启后u盘无法识别

统信UOS/麒麟KYLINOS禁用USB存储_重启_12

13、删除10-usb-block.rules取消禁用

pdsyw@pdsyw-PC:~/Desktop$ sudo rm -rf /etc/udev/rules.d/10-usb-block.rules 
请输入密码:
验证成功
pdsyw@pdsyw-PC:~/Desktop$ reboot

统信UOS/麒麟KYLINOS禁用USB存储_uos_13

14、重启后可以识别u盘

统信UOS/麒麟KYLINOS禁用USB存储_Desktop_14


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月19日 0

暂无评论

推荐阅读
  6YY0QMPUXEwu   2023年12月10日   29   0   0 linux网卡
  nIt0XG0acU8j   2023年12月11日   29   0   0 linuxhtop
  Yoru5qB4TSKM   2023年12月10日   36   0   0 服务器重启IP
qkadZYAX5eto