LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-19-2011, 04:54 PM   #1
KHarvey
LQ Newbie
 
Registered: Dec 2011
Posts: 2

Rep: Reputation: Disabled
Reading the NTFS permissions from Linux


I am attempting to port some of my custom apps from a Windows environment to a Linux environment. One of these apps parses NTFS permissions from folders on a Windows file server to a SQL database.
In Windows I used the cacls to pull out the NTFS permissions, and parse them into a database to track user folder access permissions. But in Linux I am not so sure how to go about doing this.

I am able to mount the Windows share with the ntfs-3g (CIFS), but I do not know how to view the NTFS permissions. I am able to do ls -l and pull out the *nix permissions, but that doesn't tell me the NTFS permissions.
I am pretty sure those permissions still have to exist as they are part of the files and folders. (Unless they are part of the file system itself, but even then there would have to be pointers, but I doubt that NTFS is that inefficient). Or maybe there is a translation that is done per file for the permissions?

So my question is how do I read the NTFS permissions from *nix? Is it stored in an ADS? If it is how do I identify the ADS that it is stored in? Is it stored in the file itself? If so is it stored in the same place on all files, and can I pull just that info (bit stream) from the file?
Or am I missing a simple command that tells me that info?
If it is stored as a SID or a GUID that is no problem, as I can just translate them from Active Diretory.

My goal is to just read the permissions not to alter them.

Any help would be greatly appreciated. Also if anyone is curious, I am coding in Python on TinyCore.
 
Old 12-19-2011, 09:17 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
ntfs dose NOT support file permissions
so that right there is your problem in trying to read them
there are non to read .

now as a security measure almost every linux OS mounts a windows NTFS partition as read ONLY by default.

change the read only to a read / write mount

most likely in your fstab file but you do not say HOW you are mounting it ?
 
Old 12-20-2011, 04:35 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
Do you mean this?
http://www.mcmcse.com/microsoft/guid...missions.shtml
If so the man page talks about that
http://linux.die.net/man/8/ntfs-3g
 
Old 12-21-2011, 02:02 PM   #4
KHarvey
LQ Newbie
 
Registered: Dec 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you both for your responses.

John VV, NTFS does support file level permissions, and enforces them. Or at least it does in the Windows environment. I know they mean close to nothing in the *nix environment.
As for read / write, I am able to do that just fine, and the mount command that I am using is:
mount -t cifs \\\\fileserver\\folder /mnt/fs -o username=Company\\jdoe

teckk, your links describe parts of what I would like to do. Your first link to the mcmcse lists out the permissions and what they mean. This is actually what I want to view. I want to be able to see those permissions, not abide by them, in *nix. For example, I would like to be able to see that Company\\jdoe has read access to /mnt/fs/test.txt or that Company\\Administrator has full control over /mnt/fs/it/

Just a few minutes after I posted my question I came up with a test to see if file permissions were stored at the file level. I took a file that I new it's exact size (1,888 bytes) and then I added around 30 different users and groups to it's NTFS permissions (in Windows). I then checked the file size again and it is still 1,888 bytes in size, I checked the file size in both Windows and *nix. So that leads me to believe that the files just have pointers on the File System that determine the permissions. So at this point, it seems that I will be unable to check file permissions from a *nix server without running a Windows VM.

I will attempt to script in a VM of Windows XP, to run my permission checks. Unless anyone can show me something that I am missing.
 
Old 12-21-2011, 02:41 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
those group permissions are in the system registry and are not part of the ntfs file format

it is an added on latter feature

you change the ntfs read, write,and groups in mounting
 
Old 12-21-2011, 06:55 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Certainly in *nix the meta-data eg name/owner/grp/perms etc is stored in the dir file/inode; the actual 'disk-file' is just data.
https://en.wikipedia.org/wiki/Inode
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux stopped reading D: / ntfs partition 2 days ago. infowarz Linux - Newbie 8 11-24-2011 03:52 PM
Where does linux store ntfs permissions? Xl1NntniNH7F Linux - Software 2 07-15-2011 05:41 PM
n00b question: Problems with linux root permissions and ntfs partition wLancer Linux - General 4 12-06-2004 04:32 PM
reading ntfs lordfoul Debian 2 09-05-2004 10:49 AM
Reading NTFS N_A_J_M Linux - Software 5 11-04-2002 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration