Only crew members are granted access to the cockpit with the captain's permission and the cockpit door to be locked to prevent unauthorized entry. However, some airlines still permit cockpit visits on the ground for family members, friends, or individuals.