Re: How to find out file owner?



If the SID is local to the machine that it is coming from, then that might
explain it. The current machine may have no way to determine who that user
is. I can't explain why Windows explorer would be able to do it as they
should be using the same APIs, but sometimes things aren't that obvious.

What is the SID in this case? Does it belong to a specific local machine
user?

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Dmitry Nogin" <dmitrynogin@xxxxxxxxxxx> wrote in message
news:%23io%23iH5QHHA.488@xxxxxxxxxxxxxxxxxxxxxxx
Yes, the problem is about SID translation. I can acquire SID but
translation into an NTAccount fails.

BTW, I can see actual value in Windows Explorer.


"Joe Kaplan" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uRGy8LaQHHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
I'm not sure what the problem is, but can you explain more about what
doesn't work? Does it crash? Can you not access the security
descriptor? Can you just not access the owner or does the translation of
the SID into an NTAccount fail?

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services
Programming"
http://www.directoryprogramming.net
--
"Dmitry Nogin" <dmitrynogin@xxxxxxxxxxx> wrote in message
news:e9Lr0EKQHHA.4172@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
The following code doesn't work for mapped drives:

using System;
using System.Text;
using System.Threading;
using System.Security.AccessControl;
using System.Security.Principal;
using System.IO;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
FileInfo fi = new FileInfo(@"c:\boot.ini");
FileSecurity fs = fi.GetAccessControl();
IdentityReference ir = fs.GetOwner(typeof(NTAccount));
Console.WriteLine(ir.Value);
}
}
}

What should I do to make it work for mapped drives or UNC (like
\\10.0.61.22\c$\boot.ini)?

(Windows XP network; logged on using domain administrator account)

Thanks







.



Relevant Pages

  • Re: How to find out file owner?
    ... get the original SID. ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.dotnet.security)
  • Re: Error setting DirecotrySearchers new ExtendedDN
    ... I was using the ExtendedDN to locate an AD account object's SID. ... I think it is a neat feature, but I haven't found anything I ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.platformsdk.security)
  • Re: How to get the correct SID format so I can search with it?
    ... I got the domain sid in the SDDL format ... I convert the objectSid into a byteand append it to the domain sid, ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.platformsdk.security)
  • Re: How to get the correct SID format so I can search with it?
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... The format just looks like this: ... a SID might look like in the LDAP world. ...
    (microsoft.public.platformsdk.security)
  • Re: AD Query based on SID
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... I saw a post back on 08/16/2006 ("Lookup account based ... SID") with a similar question. ...
    (microsoft.public.windows.server.active_directory)