1、设置全局密码
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#enable password contoso
Switch(config)#end

2、设置console密码
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#line console 0
Switch(config-line)#password contoso
Switch(config-line)#login
Switch(config-line)#end

3、设置telnet密码
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#line vty 0 4
Switch(config-line)#password contoso
Switch(config-line)#login
Switch(config-line)#end