How to mount properly ntfs partition shared between linux and windows

0

I'm currently using a multiboot with Ubuntu 14.04, Ubuntu 15.10 and Windows 10.

I' would like to share two partitions between those os :

  • One, named Worspace, to contain all my projects
  • The other with all others datas : pictures, movies, text documents, executables for windows.

I've first understand that I must use ntfs partitions, so let's go with it !

In order to mount them at boot, I've found this tutorial about ntfs-3g. And also found here a lot of similar question, but with no real solutions concerning the permissions.

Then I've edit the /etc/fstab file like that :

UUID=61B743CF0679FFF0   /home/xavier/Workspace    ntfs-3g auto,users,permissions 0 0
UUID=B88227AF822770D4   /home/xavier/Data    ntfs-3g uid=xavier,gid=users 0 0

And here start my problem : With that config, all the file are load with all permissions :

$ stat Data/
Fichier : «Data/»
Taille : 4096       Blocs : 8          Blocs d'E/S : 4096   répertoire
Périphérique : 80bh/2059d   Inœud : 5           Liens : 1
Accès : (0777/drwxrwxrwx)  UID : ( 1000/  xavier)   GID : (  100/   users)
Accès : 2016-03-04 18:32:02.557780000 +0100
Modif. : 2016-03-04 18:31:56.431991300 +0100
Changt : 2016-03-04 18:31:56.431991300 +0100
Créé : -

And I don't want that, at least concerning the files. The tutorial for ntfs-3g explain how to set the permission to 644 for files. That work great but :

Some files are executables !

So I'd like to force ntfs-3g to make a distinction, or to keep the already existing permissions.

To resume, I want .exe file to be 755, linux executable file 755 also. The folder might be on 755 with the right user to be able to add files and other...

It would be nice if git approve the solution and don't tell me the mode of all my files have change.

If anyone have a solution for that, it will be great !

For the partition containing Data, I've found a start of a solution with this script, but I don't really like it, because I would have to run it all the time...

sudo chmod -R 666 /media/Data
sudo find /media/Data -type d -exec chmod 755 {} \;
sudo find /media/Data -name "*.exe" -exec chmod 755 {} \;

Thanks for your help.

Xavier

Xavier C.

Posted 2016-03-05T13:05:18.680

Reputation: 101

1NTFS doesn't support the concept of an "executable bit," so AFAIK there's no way to store that information on under NTFS. Furthermore, a Windows .exe file is not executable in Linux, so from a Linux system perspective, it should not have that bit set. (Granted, they can be executed via WINE, but WINE does not require the executable bit be present, so that's not really an issue.) If you're relying on Linux filesystem features, you should use a Linux-native filesystem. There are Windows drivers for some of these if you really need access from Windows; or you can split up your data. – Rod Smith – 2016-03-05T15:29:27.567

Thank you Rod Smith for your answer.

With your answer, I realize that my problem might have two differents solution for each partitions.

For the partition concerning data, I will mount it in ntfs, and don't touch at the permissions, that might be enough.

For the one with project, I will have a look at the Windows drivers you mention. – Xavier C. – 2016-03-05T18:39:21.797

Answers

0

Ok, thanks to the help of Rod Smith and some more research, I'm able to say that I've found what I was looking.

One partition containing data shared on all OS :

The best way I've found, is to use an ntfs partition, and to mount it in your home with default permission. Here is the corresponding part of /etc/fstab

UUID=B88227AF822770D4   /home/xavier/Data    ntfs defaults 0 0

That mount the partition as /home/xavier/Data will all permission for everything. But that is not a problem.

One partition containing projects with git depository that must be accessible on all Linux OS and readable on Windows :

The best way to do it, is to create an EXT4 partition. Then you can mount it on the Linux OS, here is the corresponding part of /etc/fstab

UUID=f2c967e0-6d79-4c69-af2c-256b39c5fcd8   /home/xavier/Workspace    ext4    defaults        0       2

That mount the partition as /home/xavier/Workspace with the rights permissions for the user xavier

Then you can access it on Windows with Ext2Fsd but it will stay as read-only.

I hope that will help :)

Xavier

Xavier C.

Posted 2016-03-05T13:05:18.680

Reputation: 101