防止U复制电脑上的资料|长沙网络维护

2020-07-12 0

在不使用任何辅助软件工具的情况下,使电脑USB接口使用权限控制任意控制,禁止公司员工利用U盘、移动存储设备拷贝数据资料,且不影响USB外设备正常使用,其方法如下:

25526.jpg

1、首先,关闭USB存储设备的盘符自动分配,打开注册表,找到HKEY_LOCAL_MACHINE\SYSTEM \CurrentControlSet\Services\USBSTOR,将"Start"的值改为4(禁止自动启动),默认为3是自动分配盘符

2、干掉USB存储设备的作用文件:进入WINDOWS系统目录,找到X:\Windows\inf,这里说明一下,USB存储设备的作用文件有两个,分别是usbstor.inf和usbstor.pnf,因为后续可能需要重新打开USB功能,所以不要删除它,建议拷贝到其他位置,当然你要暴力一点,删除它也没关系,但记得做好备份。


用四条批处理指令实现:

copy %Windir%\inf\usbstor.inf %Windir%\usbstor.inf /y >nul

copy %Windir%\inf\usbstor.pnf %Windir%\usbstor.pnf /y >nul

del %Windir%\inf\usbstor.pnf /q/f >nul

del %Windir%\inf\usbstor.inf /q/f >nul


3、然后,禁止将电脑里的资料拷贝到USB存储设备,意思是把USB存储设备设置只读的。

打开注册表:定位到HKEY_LOCAL_MACHINE\SYSTEM \CurrentControlSet\Control,在其下新建一个名为“StorageDevicePolicies”的项,选中它,在右边的窗格中新建一个名为“WriteProtect”的DWORD值,并将其数值数据设置为1,有了这一条,你就是能用USB存储设备,也只能单方面读取数据了。


到此,基本上第一个过程基本完成,实现的功能包括:禁止使用USB存储设备,不影响其他USB外设,就算要用,也把USB 存储设备设置成只读。


接下来说第二个部分:如何开启?(部分用户需要使用USB存储设备) 实际上,逆向操作以上步骤就可以完成开启,但为了表达的更完整一些,我还是把过程写下来


1、找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services \USBSTOR,将"Start"的值改为3

2、恢复USB存储设备作用文件,还是4行指令:

copy %Windir%\usbstor.inf %Windir%\inf\usbstor.inf /y >nul

copy %Windir%\usbstor.pnf %Windir%\inf\usbstor.pnf /y >nul

del %Windir%\usbstor.pnf /q/f >nul

del %Windir%\usbstor.inf /q/f >nul


完成后,用户可使用USB存储设备,但不能往里面写入任何内容!这样,关闭也写了,开启也写了,接下来的事情,你知道的,批处理代码如下:


关闭过程:

@echo off

reg add "HKEY_LOCAL_ MACHINESYSTEMCurrentControlSet ControlStorageDevicePolicies“ /v WriteProtect /t reg_dword /d 1 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f

copy %Windir%\inf\usbstor.inf %Windir%\usbstor.inf /y >nul

copy %Windir%\inf\usbstor.pnf %Windir%\usbstor.pnf /y >nul

del %Windir%\inf\usbstor.pnf /q/f >nul

del %Windir%\inf\usbstor.inf /q/f >nul

@echo on


开启过程:

@echo off reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 3 /f

copy %Windir%\usbstor.inf %Windir%\inf\usbstor.inf /y >nul

copy %Windir%\usbstor.pnf %Windir%\inf\usbstor.pnf /y >nul

del %Windir%\usbstor.pnf /q/f >nul

del %Windir%\usbstor.inf /q/f >nul

@echo on


将以上代码保存为两个BAT文档,然后放进x:\Windows\system32\目录下,比如 DisableUSB.bat和EnableUSB.bat

然后直接在运行里面输入指令:DisableUSB (关闭),EnableUSB(开启)



To Top