usb禁用验证

usb禁用验证

执行命令

mv /tmp/usb-storage.ko ./

insmod ./usb-storage.ko

sleep 1

fdisk -l | grep 15.5

sleep 1

lsmod | grep usb

sh /tmp/usb.sh

sleep 1

fdisk -l | grep 15.5

sleep 1

lsmod | grep usb

exit

现在usb-storage.ko位置是

[root@logs10 ~]# ls /root/usb-storage.ko

/root/usb-storage.ko

脚本:

[root@UDPI01 ~]# cat usb.sh
#!/bin/bash
rmmod usb-storage
mv /lib/modules/`uname -r`/kernel/drivers/usb/storage/usb-storage.ko /tmp/

恢复命令如下:

[root@ruancai15 storage]# mv /tmp/usb-storage.ko ./
[root@ruancai15 storage]# insmod ./usb-storage.ko
[root@ruancai15 storage]# lsmod | grep usb
usb_storage            49452  0
[root@ruancai15 storage]# fdisk -l

Disk /dev/sda: 1798.7 GB, 1798651772928 bytes
255 heads, 63 sectors/track, 218673 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x55f098cb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64      201846  1620814848   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3          201846      208221    51200000   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4          208221      218674    83968000    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5          208221      214595    51200000   83  Linux
/dev/sda6          214595      218674    32765952   82  Linux swap / Solaris

Disk /dev/sdb: 7784 MB, 7784628224 bytes
88 heads, 24 sectors/track, 7199 cylinders
Units = cylinders of 2112 * 512 = 1081344 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x04030201

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               2        7200     7600596    b  W95 FAT32
[root@ruancai15 storage]#

原文地址:https://www.cnblogs.com/idvcn/p/9067557.html