Any way of maintaining permissions when using NTFS mounted drive in Ubuntu?

14,613

Solution 1

If the partition is being shared with ubuntu and windows, you can use ntfs-3g.usermap to create a user map file.

Assume the partition is /dev/sdXn mounted at /NTFS

1) umount the partition

sudo umount /dev/sdXn

2) run ntfs-3g.usermap (it will create a file UserMapping at current directory)

 sudo ntfs-3g.usermap /dev/sdXn

3) remount

sudo mount /dev/sdXn

4)* copy UserMapping file

sudo mkdir /NTFS/.NTFS-3G
sudo cp UserMapping /NTFS.NTFS-3G/

Now everything should work. At least it worked for me in Ubuntu 11.10

The latest (23.12.2015) Tuxera page suggest the copying to /.NTFS-3G/:

The resulting mapping file is written on file UserMapping in the current directory. For the file to be usable, first mount the volume, then copy UserMapping to /.NTFS-3G/UserMapping in the mounted directory, then unmount the volume and mount it again.

So something like this:

sudo mkdir /.NTFS-3G
sudo cp UserMapping /.NTFS-3G/

Solution 2

Well you have a few options.

First, you can try the fsdriver

http://sourceforge.net/projects/ext2read/

I do not know how well that driver will work, but if it does I would go that route as you use primarily Ubuntu.

The other option is to mount your ntfs partiton with linux permissions. You will need to add a line in fstab similar to

UUID=12102C02102CEB83  /media/windows  ntfs-3g  auto,users,permissions  0  0

Change your uuid to your windows partition ( use sudo blkid )

Assuming that works you can use a link or mount bind (again, an entry in fstab)

/media/windows/www /var/www none defaults,bind 0 0 

The disadvantage of the second method is ubuntu is not going to debug a ntfs partition if there is a problem with the file system.

Edit: One other potential solution - Run Windows in Virtualbox (or KVM) and use a shared folder or network share (samba).

Good luck

Solution 3

This worked for me on Lubuntu 15.10

  1. Open a terminal

ctrl+alt+t

  1. Unmount the ntfs drive (replace sdx with your drive; mine is sda3)

sudo umount /dev/sdx

  1. Edit fstab so ntfs-3g is used (ubuntu comes with leafpad installed; in other ditro's you might use gedit or a different text editor)

sudo leafpad /etc/fstab

  1. Change from ntfs to ntfs-3g. Something like this:

#Entry for /dev/sdx :

UUID=3844444444004444 /mnt/diskname ntfs-3g default,auto 0 0

  1. Save and close

  2. Mount all drives

sudo mount -a

  1. Open a file browser with root rights. (lubutu comes with pcmanfm installed however for other distributions you might have another file browser installed)

sudo pcmanfm

  1. Navigate to the folder you want and right click on it the File Proprieties window should open. Go to the Permissions tab and choose what you need.

enter image description here

  1. Click OK then everything should be just the way you want. (I also rebooted but I do not think is required)
Share:
14,613

Related videos on Youtube

goldenapples
Author by

goldenapples

Updated on September 18, 2022

Comments

  • goldenapples
    goldenapples over 1 year

    In my web development work, I use Ubuntu almost exclusively. But there are occasions where I need to boot up Windows -- to check a layout in IE, to reslice a comp in Photoshop -- and I want to be able to share my entire localhost environment between the two.

    Here's my current workflow:

    In Ubuntu:

    • rsync the directory of the site I'm working on from /var/www to /windows/wamp/www (where /windows is the mount location of my windows NTFS partition as set in fstab).
    • rsync the mysql database from /var/lib/mysql to /windows/wamp/bin/mysql/{mysql version}/data.

    Shut down, boot Windows, edit files, save, restart again. Back in Ubuntu, look for changed files and rsync back to /var/www, ignoring the permissions changes that have happened when moving the files to the NTFS partition.

    I don't like keeping two copies of my entire development environment, and I don't like having to manually sync them. Ideally I'd like to copy my entire /var/www folder into the Windows partition and symlink to it, and do the same thing for my databases. But the permissions changes that happen cause no end of headaches when doing that.

    So my question is two-part, I guess:

    • Is there any way of copying files from ext4 drive partitions to NTFS partitions that maintains the Unix permissions in a way that they can be synced back?

    or,

    • Is there a better way of sharing the entire localhost environment between Windows and Linux partitions?
  • goldenapples
    goldenapples over 12 years
    Thanks. Hmm.. when I tried to install ext2read on windows last week, I thought that it gave me an error saying it wasn't compatible with Windows 7. Will try again. I also wasn't aware of the "permissions" option in fstab, I'll read up on that.
  • Panther
    Panther over 12 years
    As I indicated, I have not tried ext2read on Windows. Another option might be to run windows in virtualbox with a shared folder.
  • Andrea
    Andrea over 10 years
    This is not the correct solution now. NTFS-3G supports User Mappings, which are a much better way and have better compatibility with Windows. Plus, it means your existing file permissions from Windows are retained :)
  • Andrea
    Andrea over 10 years
    Thanks very much for this! This is a much better solution than editing fstab, and it's the modern, non-deprecated one :)