11

I have a luks setup with encrypted partition. And I don't want everyone on my computer to see that I have such partition. Unfortunately it shows up in the nautilus "devices" panel as "Encrypted partition".

Is there a way to prevent it from showing there? I managed to setup authentication with usb key and I don't want the encrypted partition show in the panel.

7

You can use the mount option x-gvfs-hide in /etc/fstab to hide it in nautilus, for example.

For example, a line in /etc/fstab would become:

/dev/sda1 /mnt/sda1 ext4   defaults,x-gvfs-hide       0     2

Edit: Or you can create a fake line in /etc/fstab like this

/dev/sda2 /mnt/sda2 ext4 noauto,x-gvfs-hide 0 2

for the sole purpose of hiding it in nautilus. It will not be mounted so the mount point could not exist.

4

This question deserves an update for Ubuntu 16.04 with user friendly steps.

What you see on the left side of Nautilus are your partitions. Mounted ones have the eject button beside them, unmounted ones do not. To mount the partition click on the name. Then you can navigate the folders and files.

You want to hide partitions so they don't appear in Nautilus.

Start Dash the first option on the Launcher

Type Disks and you will see the application Disks appear. Click on it.

A screen similar to this appears:

Open Disks

Left click on a Disk. Then left click on the Partition you want to hide.

Right click on the gear (follows the Left Arrow and -) and select Edit Mount Options and this screen appears:

enter image description here

Uncheck the option Show in User Interface.

Click OK and enter password to apply changes. After the next reboot Nautilus won't show the partition. Note that this doesn't erase the partition or delete any data on it.

If you need clarification please post a comment below.

  • That does work only for non LUKS partitions for me. He is asking about LUKS partitions specifically. – Ini Dec 27 '18 at 9:52
  • @Ini Please post a new question with a link to above question stating why it's not working for you. – WinEunuuchs2Unix Dec 27 '18 at 12:07
  • The thread would be an exact copy of this one. The question from @yemu is pretty clear. I mean I could attach a screenshot from an encrypted drive showing up in Nautilus, but I don't know if that would make a big difference in clarity. The solution of this answer does not work — the partition only does not appear in Nautilus once decrypted when you specify the settings suggested in this answer. The encrypted partition still appears in Nautilus. In gnome-disks you can also ONLY specify mount options once you entered your password and the partition is decrypted. – Ini Jan 8 at 13:18
  • Furthermore that's why i also think /etc/fstab wouldn't the right place to go to search for a solution. – Ini Jan 8 at 13:19
3

You can just add it to /etc/fstab (this will cause it to be mounted automatically at startup). If you specify a mount point outside /media you don't see it in Nautilus anymore.

For those who don't know how to do this here's an example:

If you had a logical volume /dev/sda2 of the filesystem-type ext3 that you want to mount to a directory Music, because it contains your Music, you have to add the following new line to /etc/fstab:

/dev/sda2 /mnt/Music ext3 defaults 0 0

For other filesystems or names you just edit this line. Then, you save the file, make the mount point with sudo mkdir /mnt/Music, or whatever you want to name the mount point. If you don't want to reboot to see the change, just once execute sudo mount -a.

  • 1
    if you have bound-mounts in fstab, like /home/username/some/path /home/username/some/other/path auto auto,uid=username,gid=users,bind 0 0, they still appear in Nautilus. – sastanin Sep 27 '12 at 8:58
3

To avoid command line, you can open Applications > Disks.

Select the partition you want to hide, click on the gear icon ("additional partition option") > Edit Mount Options and unchecked "Show in user interface". Reboot, the partition is now hidden.

Tested on Ubuntu 16.04 LTS

  • Mount options are greyed out for encrypted partitions. Only when you decrypt the partition via entering your password you have mount options on that decrypted partition, which does not change the fact that the encrypted partition will appear in Nautilus. – Ini Jan 8 at 13:21
0

The following works for me on Ubuntu 18.04:

  1. Create a udevd rule:

    $ sudo touch /etc/udev/rules.d/99-hide-disks.rules

    with the following contents:

    ENV{ID_FS_UUID}=="<UUID>",ENV{UDISKS_IGNORE}="1"

    replace the <UUID> with the UUID of the partition that should be hidden in Nautilus.

  2. In order to apply these new settings to Nautilus without a reboot, execute the following commands:

    $ sudo udevadm control --reload-rules

    $ sudo udevadm trigger

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.