Register FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu Jun 20, 2013 03:24



Post new topic Reply to topic  [ 10 posts ] 
Archive bit on NTFS-3G drive 
Author Message

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Archive bit on NTFS-3G drive
Here is an excerpt from SAMBA 3.4.2 (/source3/smbd/dosmode.c)

Code:
/****************************************************************************
Change a dos mode to a unix mode.
    Base permission for files:
         if creating file and inheriting (i.e. parent_dir != NULL)
           apply read/write bits from parent directory.
         else   
           everybody gets read bit set
         dos readonly is represented in unix by removing everyone's write bit
         dos archive is represented in unix by the user's execute bit
         dos system is represented in unix by the group's execute bit
         dos hidden is represented in unix by the other's execute bit
         if !inheriting {
           Then apply create mask,
           then add force bits.
         }
    Base permission for directories:
         dos directory is represented in unix by unix's dir bit and the exec bit
         if !inheriting {
           Then apply create mask,
           then add force bits.
         }
****************************************************************************/


A switcheable Archive bit is mapped to 0100 attribute bit (User Execute, --x------)
Did Tuxera considered a mount (-o) parameter for a possible workaround? Of course, there's no executable bit on NTFS, but reverse mapping would help a lot, because xattr isn't still widely used, and custom xattrs arent at all.


Thu Dec 17, 2009 19:56
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1013
Post Re: Archive bit on NTFS-3G drive
Hi,

Quote:
dos readonly is represented in unix by removing everyone's write bit
dos archive is represented in unix by the user's execute bit
dos system is represented in unix by the group's execute bit
dos hidden is represented in unix by the other's execute bit

Samba maps its own permissions to Linux permission.
Quote:
Did Tuxera considered a mount (-o) parameter for a possible workaround? Of course, there's no executable bit on NTFS

Yes, ntfs-3g-2009.11.14 fully supports Posix permissions, it behaves exactly as ext3, and there is an executable bit on NTFS.
However you have to use adequate options and insert a user mapping file :

Create a directory named .NTFS-3G (use capitals and do not forget the initial dot !), and, in this directory insert a file named UserMapping (only U and M as capital letters), containing this single line :
Code:
::S-1-5-21-3141592653-589793238-462643383-10000

and it should be OK. Please read the ntfs-3g manual or http://www.tuxera.com/community/ntfs-3g ... rmissions/ for explanations.

Regards

Jean-Pierre


Thu Dec 17, 2009 20:25
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: Archive bit on NTFS-3G drive
jpa,
but what if one decides using GID and UID mount options with explicit numbers instead of ACLs?


Thu Dec 17, 2009 20:55
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1013
Post Re: Archive bit on NTFS-3G drive
Hi,

Quote:
but what if one decides using GID and UID mount options with explicit numbers instead of ACLs?

NTFS designers have decided 30 years ago to store ownership data as SIDs in ACLs along with permissions and I have no intention of inventing my own way.

But, if you define user mapping as I tell you, you may leave the gid and gid mount options, they will not be used.

Regards

Jean-Pierre


Thu Dec 17, 2009 21:59
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: Archive bit on NTFS-3G drive
jpa,
Regardless which user sid (short form) i set the user is always root. User group is set correctly by ACL
:roll:

I mean first user and group SIDs in ntfs-3g.secaudit -vv output (ACE#1 and ACE#2, both with access alowed)
If there is something wrong?


Thu Dec 17, 2009 22:05
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1013
Post Re: Archive bit on NTFS-3G drive
Hi,
Quote:
Regardless which user sid (short form) i set the user is always root.

What is your configuration ? did you define a user mapping ?
Are you setting the user by chown or chgrp and are you allowed to change the owner (you must be root or owner of file).

Quote:
I mean first user and group SIDs in ntfs-3g.secaudit -vv output (ACE#1 and ACE#2, both with access alowed)
If there is something wrong?

Owner and group are not always first and second ACE, and this depends on the permissions and the owner or group being root. I need the result of secaudit to tell for sure.
Try several values (as root, it is easier), such as :
Code:
chown 1000:1099 file
chown 1010:1088 file


Regards

Jean-Pierre


Thu Dec 17, 2009 22:22
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: Archive bit on NTFS-3G drive
Quote:
Code:
chown 1000:1099 file
chown 1010:1088 file


My groups and passwd layout is a bit different, but when executed a command set both top record's user &group SID to same value.
It's correct?

I have a full string filled, i.e. both (gid and uid) numbers in semicolons and an ACL in third parameter
But when tried setting a group and a user in different lines (empty first semicolon in group), got on mount:
Code:
There were no valid user or no valid group


Does ntfs-3g allow incomplete lines? Which is the exact syntax & field meaning of UserMapping ?


Thu Dec 17, 2009 22:57
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: Archive bit on NTFS-3G drive
Or it's a single per-object ACL system? (unlike NTFS)


Thu Dec 17, 2009 22:58
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1013
Post Re: Archive bit on NTFS-3G drive
Hi,

Code:
chown 1000:1099 file
chown 1010:1088 file


These are commands you can type on the console, which I recommended for checking ownership. These are NOT to be placed in UserMapping

Quote:
I have a full string filled, i.e. both (gid and uid) numbers in semicolons and an ACL in third parameter

use colons (:) not semicolons (;) and the third field is a SID, such as :
Code:
500::S-1-5-21-1833069642-4243175381-1340018762-1008

Using the same SID for uid and gid is not recommended (the SID is the part starting with the letter S).

Quote:
But when tried setting a group and a user in different lines (empty first semicolon in group), got on mount:
Code:
There were no valid user or no valid group

That means your file is wrong.

It would be more simple to debug it if you posted it.

Quote:
Does ntfs-3g allow incomplete lines?

No

Quote:
Which is the exact syntax & field meaning of UserMapping ?

uid:gid:SID
uid is a number or login name of a linux account, or is left void
gid is a number or group name of a linux group, or is left void
(either the uid or the gid should be left void, to avoid reusing the SID).
SID is a sequence of strange numbers with constraints defined by Microsoft

As a first step, you should just use the example I told you.

This is a more complex example, with one account (uid=500, gid=500) usable on Windows

Code:
500::S-1-5-21-1833069642-4243175381-1340018762-1008
:500:S-1-5-21-1833069642-4243175381-1340018762-513
::S-1-5-21-1833069642-4243175381-1340018762-10000


Regards

Jean-Pierre


Thu Dec 17, 2009 23:17
Profile

Joined: Mon Nov 30, 2009 21:35
Posts: 38
Post Re: Archive bit on NTFS-3G drive
Everything is correct, only typo with colons (meant ':')
When told about chmod my only idea was that group and user's ids are a bit different numbers from yours

Replied in another topic: viewtopic.php?f=2&t=2755&p=7847


Fri Dec 18, 2009 19:26
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.