EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Set Attributes for Folder/File through SFTP

Posted: 04/20/2009 02:49:43
by Monika Sharma (Standard support level)
Joined: 02/20/2009
Posts: 20


I am creating folder through my dot net code on Unix Server using SFTP.MakeDirectory()method. I want to set it attributes "777" so other can write files in this folder.

Currently I am executing "chmod 777" command through SSH after creating folder.
Due to some reason we need to avoid SSh commands.

Is there any way to set attributes using SFTP method.

Monika Sharma
Posted: 04/20/2009 04:19:03
by Ken Ivanov (Team)

Please use TElSimpleSFTPClient.SetAttributes() method (or SetAttributesByHandle() for the opened files).
Posted: 04/20/2009 04:35:19
by Monika Sharma (Standard support level)
Joined: 02/20/2009
Posts: 20


I have used following code to set the fodler attributes

SBSftpCommon.TElSftpFileAttributes attr = new SBSftpCommon.TElSftpFileAttributes();

attr.Directory = true;
attr.GroupExecute = true;
attr.GroupRead = true;
attr.GroupWrite = true;
attr.UserRead = true;
attr.UserExecute = true;
attr.UserWrite = true;
attr.OtherRead = true;
attr.OtherExecute = true;
attr.OtherWrite = true;

_sftpClient.SetAttributes("/export/home/a78665/ClientsTest/01808/Processed", attr);

This is working fine for file. But Folder attributes are not set by this. Folder attributes are always set "755" and not getting overwritten by executing the above code

Same thing I have tried at the time of creating the folder also but the problem is same
_sftpClient.MakeDirectory(folder, attr);

Any idea how to set the attributes for a folder at Unix Server

Thanks & Regards
Monika Sharma
Posted: 04/20/2009 04:47:59
by Ken Ivanov (Team)

Remember to set the TElSftpFileAttributes.IncludedAttributes flag set according to the exact attributes you need to change.



Topic viewed 1592 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!