EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Set Attributes for Folder/File through SFTP

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#9744
Posted: 04/20/2009 02:49:43
by Monika Sharma (Standard support level)
Joined: 02/20/2009
Posts: 20

Hi

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.

Thanks
Monika Sharma
#9747
Posted: 04/20/2009 04:19:03
by Ken Ivanov (EldoS Corp.)

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

Hi

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
#9750
Posted: 04/20/2009 04:47:59
by Ken Ivanov (EldoS Corp.)

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

Reply

Statistics

Topic viewed 1483 times

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




|

Back to top

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

Got it!