I am trying to use the extended file attribute to store some information after I uploaded a file into remote machine (Ubuntu 16.04 LTS) from Windows using Renci SSH.NET SFTP library. But the attributes are not getting preserved?
This how I am trying to set the extended attributes
SftpFileAttributes fileAttrs = sftpClient.GetAttributes(remoteFilePath);
IDictionary<string, string> additionalAttrs = new Dictionary<string, string>();
additionalAttrs.Add(new KeyValuePair<string, string>("user.from", "abc"));
additionalAttrs.Add(new KeyValuePair<string, string>("user.to", "xyz"));
fileAttrs =
new SftpFileAttributes(
fileAttrs.LastAccessTime, fileAttrs.LastWriteTime, fileAttrs.Size,
fileAttrs.UserId, fileAttrs.GroupId, 222, additionalAttrs);
sftpClient.SetAttributes(remoteFilePath, fileAttrs);
So, can you help me how to approach this problem? Note that: The remote machine is configured to allow only SFTP connection for security reason.