LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-30-2017, 01:17 AM   #1
slkamath
LQ Newbie
 
Registered: Apr 2017
Posts: 7

Rep: Reputation: Disabled
Blocking USB Port in Ubuntu


Hi,

We are having 40+ Systems in Laptop's & Desktop's. In this we are having Ubuntu 12.04 to 17.04 (all the versions)

So we want to know how to block the USB Port for non usage of Pen Drive, Mobile, Hard Disk etc

Thanks in advance.

Lokesh Kamath
 
Old 05-30-2017, 04:18 AM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
If you Google for Ubuntu block usb, you will find many useful results, including (the first three):

https://askubuntu.com/questions/1539...-the-usb-ports

https://itsfoss.com/how-to-disable-usb-ports-in-ubuntu/

http://www.upubuntu.com/2011/09/how-...-ports-on.html

Let us know what works for you.
 
Old 05-30-2017, 11:01 PM   #3
slkamath
LQ Newbie
 
Registered: Apr 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hydrurga View Post
If you Google for Ubuntu block usb, you will find many useful results, including (the first three):

https://askubuntu.com/questions/1539...-the-usb-ports

https://itsfoss.com/how-to-disable-usb-ports-in-ubuntu/

http://www.upubuntu.com/2011/09/how-...-ports-on.html

Let us know what works for you.
Thanks.

These things i already tried. No use.

Any other things are there let me know.

Lokesh Kamath
 
Old 05-31-2017, 03:39 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,148

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
How about link below, have you tried it already?
https://www.cyberciti.biz/faq/linux-...torage-driver/
 
Old 05-31-2017, 03:52 AM   #5
slkamath
LQ Newbie
 
Registered: Apr 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
How about link below, have you tried it already?
https://www.cyberciti.biz/faq/linux-...torage-driver/
Thanks for your response.

I have not tried this because in this USB Keyboard & Mouse will also get disable.

Lokesh Kamath
 
Old 05-31-2017, 04:22 AM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
You could use polkit to restrict mounting of removable media only (ie superuser password prompt). Presumably your users won't/shouldn't have administration access to the respective machines, so this will limit the ability to mount removable media. As you want to support a range of *buntu versions, some will likely still be using the udisks framework, while more current versions use udisks2 ie two different rules required. The polkit framework has changed a bit over time, so I'll leave to research this for yourself, but here are some references and example threads that may be of value to you

Code:
man udisks
Code:
man polkit
https://gist.github.com/grawity/3886114
https://askubuntu.com/questions/8181...g-files-to-usb

The opposite question, but still shows the general process...
https://askubuntu.com/questions/5525...ount-usb-stick

Last edited by ferrari; 05-31-2017 at 04:24 AM.
 
Old 05-31-2017, 08:54 PM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,148

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Question

Quote:
Originally Posted by slkamath View Post
Thanks for your response.

I have not tried this because in this USB Keyboard & Mouse will also get disable.

Lokesh Kamath
Then I guess you can create or develop your own software to specifically disable and enable specific USB port.

or check out link below:
https://stackoverflow.com/questions/...ently-in-linux

I think the best way to do it is to implement a policy, not to use USB devices. Whoever violates, no excuses and no question ask will be sacked on the spot. Those who will not agree to the policy a resignation should be presented in the next hour after the implementation of the policy.

Last edited by JJJCR; 05-31-2017 at 08:58 PM. Reason: edit
 
  


Reply

Tags
block devices


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB port disable in Ubuntu 9.04 Kiwi89 Linux - Hardware 2 11-09-2011 06:07 AM
Blocking port(s) emailbuilder88 Linux - Networking 3 07-10-2011 02:05 PM
Only have 1 USB port working with Ubuntu 9 hanksegle Linux - Hardware 2 06-30-2009 03:17 PM
Why is Ubuntu blocking port 22 from Windows? edwardlinux3 Linux - Networking 2 05-01-2007 11:33 AM
Ubuntu can't see thinkpad's USB port DarkShades Linux - Laptop and Netbook 1 09-28-2005 02:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration