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


哈哈哈哈哈
哈哈哈哈哈 2023-11-17 15:13:55 51196
分类专栏: 资讯

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$

图片

 

2、查看USB存储信息

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

图片

 

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

 

图片

 

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

 

图片

 

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

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

图片

 

6、移除后查看USB信息

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

图片

 

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

图片

 

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

 

图片

 

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

图片

 

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

 

图片

 

 

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

图片

 

12、重启后u盘无法识别

 

图片

 

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 

图片

 

14、重启后可以识别u盘

 

图片

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=28614
赞同 0
评论 0 条
哈哈哈哈哈L0
粉丝 0 发表 9 + 关注 私信
上周热门
如何使用 StarRocks 管理和优化数据湖中的数据?  2956
【软件正版化】软件正版化工作要点  2875
统信UOS试玩黑神话:悟空  2839
信刻光盘安全隔离与信息交换系统  2733
镜舟科技与中启乘数科技达成战略合作,共筑数据服务新生态  1267
grub引导程序无法找到指定设备和分区  1231
华为全联接大会2024丨软通动力分论坛精彩议程抢先看!  165
2024海洋能源产业融合发展论坛暨博览会同期活动-海洋能源与数字化智能化论坛成功举办  163
点击报名 | 京东2025校招进校行程预告  163
华为纯血鸿蒙正式版9月底见!但Mate 70的内情还得接着挖...  159
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
信创开放社区邀请他人注册的具体步骤如下 15
如何玩转信创开放社区—从小白进阶到专家 15
方德桌面操作系统 14
我有15积分有什么用? 13
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

加入交流群

请使用微信扫一扫!