I have 4 computers connected in LAN network. I made some program for file managing. My problem is that i can't get or set owner of, when i access to some file in other pc. I searched on the internet for answers, but nothing solves my problem. Is is possible to get or set owner of file on other pc?
I tried this:
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog f = new OpenFileDialog();
f.ShowDialog();
path = f.FileName;
}
private void button1_Click(object sender, EventArgs e)
{
FileSecurity fileS = File.GetAccessControl(path);
SecurityIdentifier secId = WindowsIdentity.GetCurrent().User;
fileS.SetOwner(secId);
fileS.SetAccessRule(new FileSystemAccessRule(secId, FileSystemRights.FullControl, AccessControlType.Allow));
string getOwner = File.GetAccessControl(filepath).GetOwner(typeof(NTAccount)).ToString();
MessageBox.Show(getOwner);
}