Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been through this kind of feature in older versions of Ubuntu. When I'd like to mount a partition it will ask me a password. Now I want to enable that kind of feature in Ubuntu 12.04.

How can I achieve this?

share|improve this question
up vote 7 down vote accepted

According to the Ubuntu ManPage Repository, pklocalauthority - PolicyKit Local Authority makes a distinction between user authentication (to make the user in front of the system prove he really is the user) and administrator authentication (to make the user in front of the system prove he really is an administrator)

Therefore you can use this policykit to provide administration authentication for mounting all (internal and external) devices.

To do so, follow these steps:

  1. Open a terminal(CTRL+ALT+T) and type:

    gksu gedit /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
  2. In line 4, look for ResultActive=yes and change it to:

  3. Save and Close the file.

Ubuntu will now require a password when mounting all drives (internal and external drives).

For specific partitions:

In 10.04 and newer versions, mounting all devices (internal and external) are allowed without asking for password unless it was defined in the filesystem table (fstab) file.

Therefore, to make Ubuntu prompt users for sudo password when mounting specific partitions, you need to edit your fstab file.

To do so, follow these steps:

  1. Open a terminal and type:

    gksu gedit /etc/fstab
  2. At the last line, add the UUID of your partition with the defaults option.

    You can find out the UUIDs of partitions by running blkid in the terminal.

    For example:

    $ sudo blkid
    /dev/sda1: UUID="5474ce02-5c07-4002-a0e7-10c8bc5dba2c" TYPE="ext4" 
    /dev/sda2: LABEL="windows" UUID="7355DDFB0563F31F" TYPE="ntfs" 
    /dev/sda5: LABEL="data" UUID="7e3fbc57-03fe-4742-bb72-756f31852059" TYPE="ext4" 
    /dev/sda6: LABEL="films" UUID="a319fb28-3061-404f-abbc-6519cf81c6c9" TYPE="ext4" 
    /dev/sda7: LABEL="tv" UUID="5D10E5D66886BCCF" TYPE="ntfs" 
    /dev/sda8: UUID="12d16683-5530-454e-809b-1a30ed47a8c9" TYPE="swap" 

    Now that you know the UUID, you can add it to the fstab file. But first, you need to create a mountpoint where the partition will be mounted.

    You can do that by running:

    sudo mkdir /path/to/dir/name-dir

    In my example, I want to mount the partition under /media/data:

    sudo mkdir /media/data

    Now, I can simply add the line below to make sure that Ubuntu prompts for a password when the "data" partition is mounted:

    UUID=7e3fbc57-03fe-4742-bb72-756f31852059 /media/data   ext4 defaults 0 0
  3. Save and Close the file.


The defaults option uses the default options that are rw, suid, dev, exec, auto, nouser, and async.

The user allows normal users to mount the device, whereas nouser lets only the root to mount the device.

For detailed information, visit How to edit and understand /etc/fstab.

share|improve this answer
thank you . I'll try that and let you your answer allow me to set password for specific partition ? – Raja Nov 4 '12 at 5:47
For specific partitions, you need to edit the file system table (fstab) file and add that specific partition with defaults option which implicitly implements the nouser option which lets only the root to mount the device. Will edit my answer to add this info. – Peachy Nov 4 '12 at 5:53
Is there anyway to do the latter option without the partitions being mounted during boot? I know that is what /etc/fstab is for... – Wilf Feb 12 '14 at 23:10

Here the answer that solved to me!

request password when mount partitions

It works not only with ntfs partitions, but with linux partitions too (ext3, ext4, etc)

I had a PC in dual boot (w7 and linux), I want deny permission to mount w7 partition when kids are using it.

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Eric Carvalho Jun 12 '14 at 12:45
Actually, all that is necessary is sudo gedit /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla add “#” at the start of line 2 Identity=unix-group:admin – Elder Geek Jun 12 '14 at 12:57

The easy answer:

edit the policy file with the command below:

sudo gedit /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

add “#” at the start of line 2

Identity=unix-group:admin;unix-group:sudo changing it to #Identity=unix-group:admin;unix-group:sudo

Since the system will no longer identify mount requests as admin or sudo requests it will require the password for mount requests not listed as user mountable in /etc/fstab.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.