Hi All,
I am trying to set the permissions of a file that I have moved to a new directory on the remote server. I am connected to the server via sFTP and the script is being run through PowerShell.
Any help would be great!.
Scott
Use this code to set remote file permissions via SFTP from PowerShell:
$sftp = New-Object Rebex.Net.Sftp $sftp.Connect("server") $sftp.Login("user", "password") $attributes = New-Object Rebex.Net.SftpAttributes $attributes.Permissions = [Rebex.Net.SftpPermissions] "OwnerWrite, OwnerRead" $sftp.SetAttributes("file.txt", $attributes) $sftp.Disconnect()
Learn to use Rebex SFTP and other components from PowerShell.
Thanks Tomas that worked! BTW you are also right that you have to list out each of the permissions.
Hi,
please check the forum question about setting remote file properties via SFTP.
Welcome to Q&A forum for C# and VB.NET developers working with following .NET components:
Applications:
If you need immediate assistance, please contact us directly.