Using Safe Defaults Mode
When you take your switch from the box and set it up for the first time, you set the safe defaults mode. You should use the safe defaults mode, which disables Telnet, STP, and SNMP. All ports are enabled in the factory default setting; you can choose to have all unconfigured ports disabled on reboot using the interactive questions. Also, STPD s0 is enabled on the default VLAN; you have the option to disable STPD in safe defaults mode.
After you connect to the console port of the switch, or after you run unconfigure switch {all} or configure switch safe-default-script, you can change management access to your device to enhance security.