• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Block USB storage in CentOS 7 

2323

How to Block USB Storage in CentOS 7

When you connect a USB storage device to your computer, by default it will mount the storage and allows the user to access the content, although the method is simple, it is not absolutely secure and is prone to malicious actions or attack on your system. You can handle this problem with some easy configuration and this tutorial covers one such method which disables USB storage in CentOS 7.


Disabling USB Storage

In order to disable the USB storage, you need to create a .conf file and edit it using a text editor.

root@linuxhelp ~ # vim /etc/modprobe.d/usb-storage.conf

Enter the following lines in the file.

install usb-storage /bin/true
~
~
~
:wq 

The above .conf file reflects fake installation of USB storage. Let us see how the above configuration affects our attempt to insert a USB device to the system.


When you insert a USB device, the following action takes place.
“ /bin/true is a command that returns zero “

True &ndash does nothing
True returns a status 0.

Now we need to reboot the machine to complete the process.

root@linuxhelp ~ # reboot


Now, if you plug a USB storage device you should not be able to access it. You can check it by running the following command.
USB Storage

In previous CentOS 6 version, you need to do the configuration in /etc/modprobe.conf, but in CentOS 7 it is deprecated and unique file must exist with the /etc/directory.d directory instead.

With this, this tutorial on blocking USB storage in CentOS 7 comes to an end. You can use this technique to prevent access to USB storage devices for unprivileged user accounts which can increase system security against certain physical attack vectors.

Tags:
mason
Author: 

Comments ( 1 )

julienduchet
hello @mason, thanks for your tips. but is there a way to block usb data, but still keep usb power going through on centOS 7. this is something we are trying to achieve at my job, but we had to cut everything. and people are complaining that they can't charge their phone anymore. thanks for your help.
Add a comment

Frequently asked questions ( 5 )

Q

How to do the same in centos/rhel6?

A

Use the configuration under "/etc/directory.d " instead of "/etc/modprobe.conf"

Q

Its is not working out after done with the configuration?

A

Have you rebooted your system so that the effect can take place

Q

How Can USB Flash Drives Be So Small?

A

USB flash drives use solid state flash technology, which stores data without using moving parts, as most physically larger internal PC hard drives do.

Q

Can I use USB Flash Drive with Mac or Linux computer?

A

Yes, you can use USB Flash Drive with Mac or Linux computer if there is USB port. The Mac OS
should be version 9 or later, and Linux kernel should be version 2.4.0 or later.

Q

Do I need install driver for using USB Flash Drive?

A

If your USB Flash Drive is formatted as FAT32, you need not to install any driver for Windows 7 and
other newer operating systems.

Related Tutorials in How to Block USB storage in CentOS 7 

Related Tutorials in How to Block USB storage in CentOS 7 

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Block USB storage in CentOS 7 

Related Forums in How to Block USB storage in CentOS 7 

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luke ?
workbench for debian

I am using workbench in CentOS whereas now I need to use Debian Operating system so could you please help to install and use in Debian?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.