Restore correct ownership on a domain folder and all its contents

INFO=($(MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -sN -e'SELECT h.www_root,s.login FROM domains d, hosting h, sys_users s WHERE s.id=h.sys_user_id AND h.dom_id=d.id AND d.name="example.com"')); chown -R ${INFO[1]}:psacln ${INFO[0]}; chown ${INFO[1]}:psaserv ${INFO[0]}

Starting from Plesk 17.8 it can be done easier

plesk repair fs example.com

Show permissions for a file and all parent folders

function namei {
    If ( $args[0] -eq $null ) {
        $path = ($pwd).Path
    } Else {
        $path = $args[0]
    }
    If ( -not (Test-Path -Path $path) ) {
        echo "Path does not exist"
        return
    }
    While ( $path -ne "" ) {
        $acl = Get-ACL -Path $path
        echo $path "`r`n"
        (
            $acl | Select -Property Owner,Group | FL | Out-String
        ).Trim()
        $acl | Select -Expand Access | Select -Property FileSystemRights,AccessControlType,IdentityReference,IsInherited | FT
        $path = $path | Split-Path
    }
}
namei C:\Windows