6

I am able to access my windows drive as pointed by the red arrow. I don't want this to happen.

enter image description here

user68186
  • 33,360
Ari
  • 61
  • 7
    Don't mount the drive? Problem solved. – ChanganAuto Aug 15 '22 at 17:20
  • 5
    Or encrypt the drive if access by others is your concern. – ubfan1 Aug 15 '22 at 18:02
  • 1
    @Rinzwind it should be noted that removal of the ntfs driver will succeed in being unable to use pendrives and/or portable HDDs, as they are all factory-formatted for NTFS. – raj Aug 15 '22 at 19:07
  • It isn't clear what you mean by this. Unless they are encrypted, the drive or partition with your Windows operating system will be trivially accessible from Ubuntu. If you just don't want to accidentally modify your Windows drive/partition while using Ubuntu then using Rinzwind's answer should give you a fair amount of confidence. OTOH if you are concerned that your Windows install isn't as secure as you thought it was, you'll need to encrypt from within Windows. What are you actually after here? – Jared Smith Aug 16 '22 at 11:17
  • The disk is in your PC and physically connected to your system. Other than encrypting or unplugging it, I don't believe there's anything you can do to disallow access to it. – Zimano Aug 16 '22 at 11:45
  • 1
    It's not clear what you want to accomplish. You want the drive to be unavailable to other Ubuntu users? Not visible on the sidebar? Impossible to access in any way? You should clarify. – tomasz Aug 16 '22 at 12:05
  • 2
    To me it is VERY simple Ari does not want to be able to mount them from the desktop, No security reasons and just an annoyance of seeing it in Nautilus. If security was the issue that would have been mentioned specifically in the question :) – Rinzwind Aug 16 '22 at 12:32
  • @raj That is not entirely correct, as a number of newer drives are formatted exFAT, which has much cross-platform compatibility... except for Amazon devices (for whatever reasons they choose not to disclose). – killermist Aug 16 '22 at 14:33

2 Answers2

10

Add the Windows partitions to /etc/fstab using these options:

UUID={UUID} /mnt/{mountpoint} ntfs defaults,noauto,umask=777 0 0
  • sudo blkid shows the UID of partitions.
  • noauto: prevents the partition from mounting automatically at boot.
  • The umask=777 means: no read, write, or execute permissions.
  • The mountpoint set to /mnt: Nautilus left panel never mounts /mnt (mounts in /media and /home do).
Rinzwind
  • 299,756
  • 3
    This will work of course, but it only blocks unprivileged users in this particular installation from accessing the files. Assuming physical access, someone can still boot from a USB stick and read/alter the files, or if that is blocked too, they can take the drive out, modify the files as they want, and put the drive back in. The only solution if data security is important is to encrypt the partition from within windows. – user000001 Aug 16 '22 at 08:37
  • 3
    @user000001 but that was not the question – Rinzwind Aug 16 '22 at 12:29
  • Will this remove the entry on the panel? Or does it just change the nature of the interaction to one where the user must supply their password to mount the drive/partition, as that action is limited to a user with sudo/wheel privileges? – killermist Aug 16 '22 at 15:07
  • The question was 2 parts: not show in nautilus and not automount. The 3rd (umask) is just to make sure you can not edit the partition. So yes it will (due to mounting in /mnt and not /home) and if it ever gets manually mounted (automount is off due to noauto) using the /etc/fstab settings the contents are empty (due to the umask). An admin can still mount but needs to supply all the options with the mount command. Also: using a live session it will also be mounted. If data safeguard is needed then yes encryption is also needed. – Rinzwind Aug 16 '22 at 15:28
1

This seems to be a change in Ubuntu 22.04 (Jammy). To reverse it, use the Settings application, and then "Appearance Settings", to access the item "Configure dock behavior". Uncheck the box for "Include unmounted volumes". That gets the result Ari is seeking.

The option to mount them - the Windows partition being the one discussed here - is still accessible using the "+ Other Locations" item in the Sidebar under Files, as before.

Rich
  • 11
  • 2
  • Nice! I hadn’t realised I wanted to do this, but it’s much cleaner not to have unmounted volumes clogging up the dock. Thank you. – Will Sep 12 '22 at 18:40