disable USB drive for guest

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
flex567
Level 1
Level 1
Posts: 23
Joined: Sun Mar 08, 2015 11:36 am

disable USB drive for guest

Post by flex567 » Sun Mar 08, 2015 11:42 am

How can I disable usb drives just for my guest account (I have mint 17.1)?

Mute Ant
Level 14
Level 14
Posts: 5135
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: disable USB drive for guest

Post by Mute Ant » Sun Mar 08, 2015 12:58 pm

A quick, reversable way to stop a user automounting devices is to put a file matching their user name into the /media/ folder. If there's a file called /media/moot it blocks making a folder called /media/moot, so user moot can't automount anything with a file system...USB stores...DVD video...CDROM.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

flex567
Level 1
Level 1
Posts: 23
Joined: Sun Mar 08, 2015 11:36 am

Re: disable USB drive for guest

Post by flex567 » Sun Mar 08, 2015 1:19 pm

Is there a way to just disable the usb drives?

cmost
Level 4
Level 4
Posts: 435
Joined: Tue Sep 18, 2007 7:36 am
Location: Newport, Kentucky

Re: disable USB drive for guest

Post by cmost » Sun Mar 08, 2015 4:25 pm

It's going to be difficult to achieve what you want because when a user plugs in a USB drive, it gets mounted to /media/username/something and that 'something' is owned by the user who created it and therefore s/he has full read-write access. The best solution for you is to use the cdrom user group. Change the permissions of the '/media' folder so that only members of cdrom group have full read,write,execute access. Deny access to all other users and groups (except root). Now, simply add which users you want to have access to removable devices to the cdrom group and all others won't have access.

If you want users to still access the CD/DVD-ROM device but not be able to mount USB sticks, then you'll have to manually edit your /etc/fstab file to hard code in another mount point for the optical drive (something other than /media, say for example /cd-rom.) Then users who are not members of the cdrom group will still be able to use the optical drive but still not be able to mount USB sticks. As root, create the new folder /cd-rom. Next, edit your /etc/fstab file as root:

Your fstab file should contain a line that looks something like this:

Code: Select all

/dev/sr0 /cd-rom/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
Dual Intel Xeon 3.6 GHz, 24 Cores
86.5 GB DDR3 RAM
nVidia GeForce GTX 660
Linux Mint 18.2 MATE 1.18 +Compiz
Kernel 4.09 LTS

flex567
Level 1
Level 1
Posts: 23
Joined: Sun Mar 08, 2015 11:36 am

Re: disable USB drive for guest

Post by flex567 » Sun Mar 08, 2015 4:37 pm

To me it would be ok if I disable cd-rom to guest user too.
Change the permissions of the '/media' folder so that only members of cdrom group have full read,write,execute access.
How do I do that?

I don't think I need to change the fstab file.

cmost
Level 4
Level 4
Posts: 435
Joined: Tue Sep 18, 2007 7:36 am
Location: Newport, Kentucky

Re: disable USB drive for guest

Post by cmost » Sun Mar 08, 2015 4:56 pm

Before you begin, make sure your own username is a member of the 'cdrom' group. You can access users and groups from Menu --> Administration -- Users & Groups.

Type the following in a terminal:

MATE

Code: Select all

sudo caja
or Cinnamon

Code: Select all

sudo nemo
Navigate to the root file system '/'

Locate the 'media' folder, right-click and select 'properties'

In the 'Permissions' tab, be sure the folder is owned by 'root and that root can create and delete files. Next set the group to cdrom and set the folder access to 'Create and Delete files'. Finally, set 'Others' folder access to 'None'.

I think you're right about not needing the fstab entry because I notice there's already a '/cdrom' folder. But keep it in mind should restricted users not be able to access CDs.
Dual Intel Xeon 3.6 GHz, 24 Cores
86.5 GB DDR3 RAM
nVidia GeForce GTX 660
Linux Mint 18.2 MATE 1.18 +Compiz
Kernel 4.09 LTS

flex567
Level 1
Level 1
Posts: 23
Joined: Sun Mar 08, 2015 11:36 am

Re: disable USB drive for guest

Post by flex567 » Mon Mar 30, 2015 11:47 am

I created a new user called prog, How can I give privileges to that user so he can access my USB drive? - just for that user and root user not for guest user.

How Can I disable access to Firefox to the new user?

Post Reply

Return to “Newbie Questions”