How to hide Ribbon from anonymous users in SharePoint

The below steps is to hide the Ribbon from the Anonymous User.

Step 1 : Open the Sharepoint Site eg: http://mydomain.com

Step 2 : Goto to Site Action and edit in Sharepoint designer

Step 3 : In Sharepoint Designer when we open then open the sharepoint site and then edit the make a copy
of v4.master and rename it eg: hideribbon.master
Step 4 : Locate this Line

<div id="s4-ribbonrow">

Step 5 : Change it to.

<div id="Div1" style="display:none">

Step 6 : Now find the end of the "s4-ribbonrow" tag and add following block right after it:

" <Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages"> 
    <script type="text/javascript"> 
        document.getElementById("s4-ribbonrow").style.display = "block";
    </script>
</
Sharepoint:SPSecurityTrimmedControl>"


Step 7: Save the new master page and publish it.

Step 8 : That's it now the "ribbon will be hidden in sharepoint site".v