Hide Ribbons to the anonymous users in SharePoint based on the PermissionsString ......
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server"
PermissionsString="AddListItems" AuthenticationRestrictions="AuthenticatedUsersOnly">
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "block";
document.getElementById("suiteBar").style.display = "block";
</script>
</SharePoint:SPSecurityTrimmedControl>
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server"
PermissionsString="AddListItems" AuthenticationRestrictions="AuthenticatedUsersOnly">
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "block";
document.getElementById("suiteBar").style.display = "block";
</script>
</SharePoint:SPSecurityTrimmedControl>