I want to hide the Windows drive in Ubuntu in Terminal and GUI, so that root cannot access it to modify the Windows disk (/dev/sda1/).

  • 3
    You can't really prevent root modifying anything in Linux. However, you can hide in nautilus to prevent accidental modification – Anwar Sep 22 '16 at 10:36
  • How to do this in nautilus? – Szewczu Sep 22 '16 at 10:37
  • You may encrypt / decrypt – Benny Sep 22 '16 at 11:14
  • This is why if you want to "keep something secret"/unaccessible you must encrypt it. Also consider that even if you could somehow configure linux to ignore that partition, whoever has physical access to your computer can boot a liveCD/USB with their linux system that will simply ignore your configuration. – Bakuriu Sep 22 '16 at 14:12
  • If it is a physical drive, just put it in an external HDD chassis and take it with you. The newer interfaces for connecting the HDD should give you on par performance, so it shouldn't be a problem from this standpoint. Another possibility would be to manipulate the firmware(not sure if it is possible at all) and put the 'de-manipulator' software on a usb drive, which you carry around with you. I guess you will need additional hardware to access the firmware, so it isn't really viable. – WalyKu Sep 22 '16 at 14:26

You can unmount the Windows partition, and remove it from the list of partitions that will be automounted on startup.

I quote the section below from https://help.ubuntu.com/community/MountingWindowsPartitions:

Option 2 - to ensure that Ubuntu does not mount the partition and also disables graphical mounting from the file manager. For example, you may wish to ensure that recovery and system partitions are never inadvertently mounted and do not appear in the file manager. In this case you need to create a mountpoint in /mnt, not /media. Modify the line below (in /etc/fstab) with your UUID and mountpoint:

UUID=519CB82E5888AD0F  /mnt/Data  ntfs  noauto,umask=222  0 0

Note: with these mount options, the partition does not appear in the Devices list in the left pane of Nautilus (the Ubuntu file manager), but it still appears in Dolphin, the Kubuntu File Manager. Clicking on the partition in Dolphin causes the display of an error message. This solution is less elegant in Dolphin than with Nautilus, but the desired effect is achieved - the partition cannot be mounted.

Another way is to set the hidden flag for the NTFS/fat partition using GParted.

Note: This is assuming you just want to prevent casual access to the Windows drive by "hiding", but preventing strict access from the root user is not possible.

  • 1
    This won't help. The disk will appear in Nautilus. – Pilot6 Sep 22 '16 at 10:51
  • @Pilot6 doesn't matter, it needs to be mounted first – prusswan Sep 22 '16 at 10:54
  • it will be mounted on click in nautilus. – Pilot6 Sep 22 '16 at 10:56
  • @prusswan .. but This drive still be visible in Terminal... – Szewczu Sep 22 '16 at 10:58
  • @Pilot6 it depends on your settings. On my system I need to specify them using fstab. – prusswan Sep 22 '16 at 11:00

Impossible. The root user is by definition all-powerful. That includes the ability to both read from and write to all attached storage devices.

The best you can do is to encrypt the Windows partition, which would prevent everybody without a valid key from

  1. making sense of the information on that partition and
  2. manipulating its content without the possibility of detection.

What you probably want is a separation of privilege, where one or more users don't have super-user privileges but only a subset thereof.

  • I had the same bit in an answer with 1 addition: deleting ntfs support also prevents it (and any other microsoft filesystem) – Rinzwind Sep 22 '16 at 10:43
  • 2
    @Rinzwind: Root can just reinstall NTFS support. Of root can dd if=/dev/zero of=/dev/sda1 if the only aim is destruction. – David Foerster Sep 22 '16 at 10:44
  • If i will hide in nautilus to prevent accidental modification ? – Szewczu Sep 22 '16 at 10:47
  • @Szewczu: I can't parse that question in a meaningful way. – David Foerster Sep 22 '16 at 10:50
  • 3
    If you have a new question please open a new question. Also, this will not root's access to the partition. It just makes its presence less obvious to whoever happens to use Nautilus. – David Foerster Sep 22 '16 at 11:03

If you want to completely hide the drive, you can set a udev rule. For example, if your Windows partition is on /dev/sda2, you can add the following to /etc/udev/rules.d/99-hide-disks.rules(you may need to create the file).


After that, simply reboot the machine.

  • This metod didnt hide drive in Terminal.. And Normal User can see this drive in System Files.. – Szewczu Sep 22 '16 at 13:10
  • It would be better to match the partition by label or UUID and this just hides the partition from UDisks, a helper tool to manage and mount drives. – David Foerster Sep 22 '16 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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