Using C# how can I get information about who has a file open?
User name and machine name would be sufficient.
In case it matters I have Windows workstations accessing files on a Linux file server via Samba.
I need this information in a program running on the workstations.
The core .NET libraries do not have any means to do this.
And if I understand you correctly, you want to know from Windows workstation A who has files open on the Linux file share and some of those users with open file might be origination from other windows boxes, if that is the case then you will need to have a service on the Linux side which you can query to provide that back to your windows work station.
On the local machine this can be achieved, but at the very least your will need to interop to OS APIs like NtQueryInformationFile and NtQueryObject (both not officially documented) amongst others. Tools like process monitor dynamically install a device driver to achieve the level of inspection that they do and that will only tell you which local file handles are open by which user.
I don't think you can do this using .NET
In the past when I've run into this issue, I've always ended up using the process monitor or process explorer.