search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Hosting & IIS7, Windows Powershell | No Comment | 2,310 views | 11/12/2010 01:22

One of my script about how to set ACL for FTP users.

1
2
3
4
5
6
7
8
9
10
11
12
Function Set-FTPACL
{
Param ($FTPUsername, $LogDir)
 
    $Account = New-Object System.Security.Principal.Ntaccount("$FTPUsername")
    $Sid = $Account.Translate([System.Security.Principal.SecurityIdentifier])
    $ACL = Get-Acl -Path "$LogDir"
    $Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
    $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
    $ACL.SetAccessRule($AccessRule)
    $ACL | Set-Acl "$LogDir"
}

$LogDir is the path of FTP directory.