How to Disable and Enable USB Device in Linux
Follow the steps
1) Add this line “blacklist usb_storage” to the end of /etc/modprobe.d/blacklist.confTo add : Open a Terminal by using Ctrl+Alt+T or Applications->Accessories->Terminal. You need to have root access to do this tweak. Copy and paste the following command in the Terminal. Type the password for the user, when prompted.
$ sudo gedit /etc/modprobe.d/blacklist.conf
The above command will open the blacklist.conf file in gedit. You can use any editor to edit this file like vim, gvim, emacs etc., Now copy and paste this line “blacklist usb_storage” at the end of the file. After adding this save it and close the gedit. Check the below screen shot.
2) Add this line “modprobe -r usb_storage” before exit 0 in /etc/rc.local
To add : Copy and paste the following command in the Terminal. Type the password for the user, if prompted.
$ sudo gedit /etc/rc.local
The above command will open the rc.local file in gedit. Now copy and paste this line “modprobe -r usb_storage” before the last line of the file. After adding this save it and close the gedit. Check the below screen shot for Fedora and Ubuntu.
For Ubunntu:
For Fedora:
Now restart your system.
To Mount USB device
Open a Terminal and use the following command. Type the password for the user, when prompted.
$ sudo modprobe usb_storage
To Unmount the USB device
Use “safely remove drive” by right click on the device, then run the below command in the Terminal. Type the password for the user, when prompted.$ sudo rmmod usb_storage
Hope this will be helpful for you!!
No comments:
Post a Comment