Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My PC have 3 NTFS partitions (main and backups) plus Ubuntu on dual boot. I want to keep NTFS partitions available, but mounted as read-only by default, so that other users (and accidentally even me) do not modify them in a harmful way. I see that I can't change permissions for the NTFS partitions, which is understandable.

If possible, I'd like that only SU could change the default permissions, so that none of the other users could modify them without switching to Windows. If not possible, making NTFS unmountable would be OK too.

I'm trying to get used to Linux environment and make Ubuntu as my main OS, and this is mostly a protective measure to avoid corrupting my Windows system, as I'll still use it quite a lot.

Note: I'm aware that NTFS permissions are useless on Ubuntu, but that's fine, as all users log as admin there.


Edit 1: this is my fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda7 during installation
UUID=4a5ff937-5220-4b4e-b994-304ba37d3448 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda8 during installation
UUID=a0285d57-8247-4efe-88ca-14bee4b8630b none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

So, I'd like to set all my 3 NTFS HDs to read only (no auto mount). Also, please tell me where to find the /path/to/ntfs of each partition.

Additionally, can I comment the floppy entry? I don't have one anyway =)


Edit 2: relevant part of 'mount -v'

/dev/sda1 on /media/1A7099D97099BC47 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sda5 on /media/Stuff type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sda6 on /media/Backup type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)

Edit 3: Ok, so I installed pysdm (Storage Device Manager), set all my NTFS partitions as mountable my any user, and as read only, and restarted. Now I can't mount the partitions:

Unprivileged user can not mount NTFS block devices using the external FUSE library. Either mount the volume as root, or rebuild NTFS-3G with integrated FUSE support and make it setuid root. Please see more information at http://ntfs-3g.org/support.html#unprivileged

After some reading it seems that mounting the partitions as SU is not a good idea. So, how can I allow the mounting (by any user) without SU?

share|improve this question
2  
Small correction: it's possible to map NTFS permissions to UNIX permissions, so they are not useless, but it's somewhat complicated (you have to map user-IDs between both, etc.). –  JanC Oct 21 '10 at 17:23
    
@JanC Interesting! Thanks for the tip, it's good to know that there is a way. If someday I dual boot with multiple users on Windows, I'll try... wait, I'm trying to move out of it! Meh, just dump that crap! =D –  mdrg Oct 21 '10 at 18:07
    
Can you do a "mount -v | grep ntfs" and post the results? –  ddeimeke Oct 22 '10 at 3:28
    
Well, I did, but no output. After mounting all three partitions and checking 'mount -v', I got something, posted above. –  mdrg Oct 22 '10 at 21:08
add comment

5 Answers

I think the easiest way to achieve this is to check your local /etc/fstab and change the options for the NTFS partition to be mounted read-only.

In a running system you can do this by "mount -o remount,ro /path/to/ntfs".

If you do not know exactly what to do please post the contents of your /etc/fstab.

share|improve this answer
    
Thanks, I'll see if I can figure out fstab by myself. Otherwise I post it here :) –  mdrg Oct 21 '10 at 15:26
    
Guess I'll need a little help here =P fstab on the question above. Thanks! –  mdrg Oct 21 '10 at 20:41
    
Oh, I see, it is not done via /etc/fstab, so there is an other mechanism, which I unfortunately do not know. –  ddeimeke Oct 22 '10 at 3:26
add comment

ntfs-config Install ntfs-config

After years of developpement, a new NTFS driver, ntfs-3g , which allow full write capability is here. Since its first stable release, it is a wonderfull success, and is daily used by thousands of people around the world. The main point people can be struggle with, is how configuring their system to be able to use it.

The aim of the ntfs-config project is to make life of people easier, by providing an easy way to enable/disable write capability for all their NTFS device, internal or external. You can see ntfs-config in action here.

you can find in GNOME Menu in System - Administration

share|improve this answer
    
Thanks, I'll take a look. It's good to see that there is a lot of good talk about ntfs-config, because the reported bugs scare me a bit, specially the ones about breaking fstab (and being a noob Linux user, it may be troublesome for me). –  mdrg Oct 21 '10 at 12:33
    
I couldn't understand what you posted, but yes, I'm thankful to all the GUI apps and frontends... I'd have a hard time if I had to learn bash properly to use Ubuntu or any other distro. Better start with GUI and then learn command line. –  mdrg Oct 21 '10 at 15:29
add comment

You could also mount it as read only using the ro-option. This way it would be read only for all users, including root

/dev/sda1        /mnt/ntfsfolder  ntfs-3g    defaults,ro 0       0
share|improve this answer
    
Yes, that was my first idea, but letting root write to the partition will be handy sooner or later. Better let things set up for that. :) –  mdrg Oct 28 '10 at 10:49
add comment
up vote 0 down vote accepted

So, I got a solution.

For those trying to do this, edit your fstab and include:

 #change '/dev/sda1' to your partition id
 #change '/mnt/ntfsfolder' to whatever mount point you want
 /dev/sda1        /mnt/ntfsfolder  ntfs-3g    defaults,umask=022 0       0

With this, only the root user will be able to write on the NTFS partition, and all other users will only be able to read it. If you want to change something on such partitions, use gksu command to execute as root. Example:

gksu nautilus

This will open Nautilus (file manager) as root.

share|improve this answer
add comment

Your Answer

 
discard

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.