{"id":90201,"date":"2024-03-04T13:23:13","date_gmt":"2024-03-04T05:23:13","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=90201"},"modified":"2024-03-04T13:23:13","modified_gmt":"2024-03-04T05:23:13","slug":"linux-disable-usb-storage","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-disable-usb-storage.html","title":{"rendered":"linux \u4e2d\u7981\u7528USB\u5b58\u50a8"},"content":{"rendered":"
\u4e3a\u4e86\u4fdd\u62a4\u6570\u636e\u4e0d\u88ab\u6cc4\u6f0f\uff0c\u6211\u4eec\u4f7f\u7528\u8f6f\u4ef6\u548c\u786c\u4ef6\u9632\u706b\u5899\u6765\u9650\u5236\u5916\u90e8\u672a\u7ecf\u6388\u6743\u7684\u8bbf\u95ee\uff0c\u4f46\u662f\u6570\u636e\u6cc4\u9732\u4e5f\u53ef\u80fd\u53d1\u751f\u5728\u5185\u90e8\u3002 \u4e3a\u4e86\u6d88\u9664\u8fd9\u79cd\u53ef\u80fd\u6027\uff0c\u673a\u6784\u4f1a\u9650\u5236\u548c\u76d1\u6d4b\u8bbf\u95ee\u4e92\u8054\u7f51\uff0c\u540c\u65f6\u7981\u7528 USB \u5b58\u50a8\u8bbe\u5907\u3002<\/p>\n
\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u4e09\u79cd\u4e0d\u540c\u7684\u65b9\u6cd5\u6765\u7981\u7528 Linux \u673a\u5668\u4e0a\u7684 USB \u5b58\u50a8\u8bbe\u5907\u3002\u6240\u6709\u8fd9\u4e09\u79cd\u65b9\u6cd5\u90fd\u5728 CentOS 6\uff067 \u673a\u5668\u4e0a\u901a\u8fc7\u6d4b\u8bd5\u3002\u90a3\u4e48\u8ba9\u6211\u4eec\u4e00\u4e00\u8ba8\u8bba\u8fd9\u4e09\u79cd\u65b9\u6cd5\u3002<\/p>\n
\uff08\u53e6\u8bf7\u9605\u8bfb: Ultimate guide to securing SSH sessions<\/a>[1]<\/span>\uff09<\/p>\n \u5728\u672c\u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u5f80\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u884c install usb-storage \/bin\/true<\/span>\uff0c \u8fd9\u4f1a\u8ba9\u5b89\u88c5 usb-storage \u6a21\u5757\u7684\u64cd\u4f5c\u5b9e\u9645\u4e0a\u53d8\u6210\u8fd0\u884c \/bin\/true<\/span>\uff0c \u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u8fd9\u79cd\u65b9\u6cd5\u53eb\u505a\u4f2a\u5b89\u88c5<\/span>\u7684\u539f\u56e0\u3002 \u5177\u4f53\u6765\u8bf4\u5c31\u662f\uff0c\u5728\u6587\u4ef6\u5939 \/etc\/modprobe.d<\/span> \u4e2d\u521b\u5efa\u5e76\u6253\u5f00\u4e00\u4e2a\u540d\u4e3a block_usb.conf<\/span> (\u4e5f\u53ef\u80fd\u53eb\u5176\u4ed6\u540d\u5b57) \uff0c<\/p>\n \u7136\u540e\u5c06\u4e0b\u884c\u5185\u5bb9\u6dfb\u52a0\u8fdb\u53bb\uff1a<\/p>\n \u6700\u540e\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u3002<\/p>\n \u8fd9\u79cd\u65b9\u6cd5\u8981\u6c42\u6211\u4eec\u5c06 USB \u5b58\u50a8\u7684\u9a71\u52a8\u7a0b\u5e8f\uff08usb_storage.ko<\/span>\uff09\u5220\u6389\u6216\u8005\u79fb\u8d70\uff0c\u4ece\u800c\u8fbe\u5230\u65e0\u6cd5\u518d\u8bbf\u95ee USB \u5b58\u50a8\u8bbe\u5907\u7684\u76ee\u7684\u3002 \u6267\u884c\u4e0b\u9762\u547d\u4ee4\u53ef\u4ee5\u5c06\u9a71\u52a8\u4ece\u5b83\u9ed8\u8ba4\u7684\u4f4d\u7f6e\u79fb\u8d70\uff1a<\/p>\n \u73b0\u5728\u5728\u9ed8\u8ba4\u7684\u4f4d\u7f6e\u4e0a\u65e0\u6cd5\u518d\u627e\u5230\u9a71\u52a8\u7a0b\u5e8f\u4e86\uff0c\u56e0\u6b64\u5f53 USB \u5b58\u50a8\u5668\u8fde\u63a5\u5230\u7cfb\u7edf\u4e0a\u65f6\u4e5f\u5c31\u65e0\u6cd5\u52a0\u8f7d\u5230\u9a71\u52a8\u7a0b\u5e8f\u4e86\uff0c\u4ece\u800c\u5bfc\u81f4\u78c1\u76d8\u4e0d\u53ef\u7528\u3002 \u4f46\u662f\u8fd9\u4e2a\u65b9\u6cd5\u6709\u4e00\u4e2a\u5c0f\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u5f53\u7cfb\u7edf\u5185\u6838\u66f4\u65b0\u7684\u65f6\u5019\uff0cusb-storage<\/span> \u6a21\u5757\u4f1a\u518d\u6b21\u51fa\u73b0\u5728\u5b83\u7684\u9ed8\u8ba4\u4f4d\u7f6e\u3002<\/p>\n \u6211\u4eec\u4e5f\u53ef\u4ee5\u901a\u8fc7 \/etc\/modprobe.d\/blacklist.conf<\/span> \u6587\u4ef6\u5c06 usb-storage \u7eb3\u5165\u9ed1\u540d\u5355\u3002\u8fd9\u4e2a\u6587\u4ef6\u5728 RHEL\/CentOS 6 \u662f\u73b0\u6210\u5c31\u6709\u7684\uff0c\u4f46\u5728 7 \u4e0a\u53ef\u80fd\u9700\u8981\u81ea\u5df1\u521b\u5efa\u3002 \u8981\u5c06 USB \u5b58\u50a8\u5217\u5165\u9ed1\u540d\u5355\uff0c\u8bf7\u4f7f\u7528 vim \u6253\u5f00\/\u521b\u5efa\u4e0a\u8ff0\u6587\u4ef6\uff1a<\/p>\n \u5e76\u8f93\u5165\u4ee5\u4e0b\u884c\u5c06 USB \u7eb3\u5165\u9ed1\u540d\u5355\uff1a<\/p>\n \u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u3002usb-storage<\/span> \u5c31\u5728\u5c31\u4f1a\u88ab\u7cfb\u7edf\u963b\u6b62\u52a0\u8f7d\uff0c\u4f46\u8fd9\u79cd\u65b9\u6cd5\u6709\u4e00\u4e2a\u5f88\u5927\u7684\u7f3a\u70b9\uff0c\u5373\u4efb\u4f55\u7279\u6743\u7528\u6237\u90fd\u53ef\u4ee5\u901a\u8fc7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u52a0\u8f7d usb-storage<\/span> \u6a21\u5757\uff0c<\/p>\n \u8fd9\u4e2a\u95ee\u9898\u4f7f\u5f97\u8fd9\u4e2a\u65b9\u6cd5\u4e0d\u662f\u90a3\u4e48\u7406\u60f3\uff0c\u4f46\u662f\u5bf9\u4e8e\u975e\u7279\u6743\u7528\u6237\u6765\u8bf4\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u6548\u679c\u5f88\u597d\u3002<\/p>\n \u5728\u66f4\u6539\u5b8c\u6210\u540e\u91cd\u65b0\u542f\u52a8\u7cfb\u7edf\uff0c\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002\u8bf7\u5c1d\u8bd5\u7528\u8fd9\u4e9b\u65b9\u6cd5\u6765\u7981\u7528 USB \u5b58\u50a8\uff0c\u5982\u679c\u60a8\u9047\u5230\u4efb\u4f55\u95ee\u9898\u6216\u6709\u4ec0\u4e48\u7591\u95ee\uff0c\u8bf7\u544a\u77e5\u6211\u4eec\u3002<\/p>\n via: http:\/\/linuxtechlab.com\/disable-usb-storage-linux\/<\/a><\/p>\n \u4f5c\u8005\uff1aShusain<\/a>[2]<\/span> \u8bd1\u8005\uff1alujun9972<\/a>[3]<\/span> \u6821\u5bf9\uff1awxy<\/a>[4]<\/span><\/p>\n \u672c\u6587\u7531 LCTT<\/a>[5]<\/span>\u539f\u521b\u7f16\u8bd1\uff0cLinux \u4e2d\u56fd<\/a>[6]<\/span>\u8363\u8a89\u63a8\u51fa<\/p>\n \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-9124-1.html<\/a><\/p>\n$ sudo vim \/etc\/modprobe.d\/block_usb.conf\r\n<\/pre>\n
install usb-storage \/bin\/true\r\n<\/pre>\n
$ sudo mv \/lib\/modules\/$(uname -r)\/kernel\/drivers\/usb\/storage\/usb-storage.ko \/home\/user1\r\n<\/pre>\n
$ sudo vim \/etc\/modprobe.d\/blacklist.conf\r\n<\/pre>\n
blacklist usb-storage\r\n<\/pre>\n
$ sudo modprobe usb-storage\r\n<\/pre>\n
\n\n