Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.