Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 52

Securing Console and VTY Access with Local Authentication

Recommended resources

Hello! In our last session, we focused on securing the data plane at Layer 2 by implementing DHCP snooping to prevent rogue server attacks. Now, we'll shift our attention from protecting network traffic to protecting the network devices themselves. This involves securing the management plane—controlling who is allowed to log in and configure your routers and switches.

This lesson is the final one in our "Switch and Device Security" module. You will learn how to secure console and VTY (remote) access using local user accounts and passwords. This is one of the first and most fundamental security configurations you should perform on any Cisco device, and it will be an essential part of your project.

1. The Foundation: Local User Authentication

By default, a new Cisco device doesn't require any credentials for console access. This is a major security risk. While you can set a simple, shared password for a login line, this method is weak and lacks accountability. A much better practice is to create a local database of individual user accounts on the device itself.

This approach offers two key advantages:

  • Accountability: You can see who is logged in (show users) and potentially log actions to a specific user.
  • Granularity: You can assign different privilege levels to different users (though we'll focus on the primary admin access for now).

To get a clear understanding of the concepts of lines, local user authentication, and the crucial difference between the password and secret commands when creating users, please read the following sections from the "Lines and local user authentication" article.

Lines and local user authentication - Learn Tech From Zero

This article provides a clear, structured explanation of device access control on Cisco devices.

Focus on these sections: Start with "What is Device Access Control?" and "What Are Lines in Cisco IOS?" to understand the basic terminology. Then, read "Local User Authentication" paying close attention to the table comparing password vs. secret. Always use secret in practice, as it provides much stronger password encryption.

The primary command to create a user is:
Switch(config)# username <your-username> secret <your-strong-password>


2. Securing the Console Port

The console port provides direct physical access to the device's command-line interface (CLI). It's your primary entry point for initial configuration and emergency recovery. Leaving it unsecured means anyone with a console cable can access your device.

To secure it, you'll instruct the console line (line console 0) to use the local user database for authentication. The video below demonstrates exactly how to do this.

Free CCNA | SSH | Day 42 | CCNA 200-301 Complete Course

This clip from Jeremy's IT Lab walks through securing the console line, contrasting the older login method with the recommended login local method.

Watch the segment from console security. Pay attention to the two key commands used in line configuration mode: login local and exec-timeout. The exec-timeout command is a valuable security measure that automatically logs out an inactive session.

The core configuration looks like this:

! First, create a user in global config mode
R1(config)# username admin secret MyS3cureP@ss!

! Then, configure the console line
R1(config)# line console 0
R1(config-line)# login local
R1(config-line)# exec-timeout 5 0  ! Sets a 5-minute inactivity timeout

3. Securing VTY Lines for Remote Access

Virtual Teletype (VTY) lines are used for remote management access via protocols like Telnet and SSH. Since your degree focuses on security, you know that Telnet is insecure because it sends all data, including passwords, in plaintext. Therefore, you should always enforce the use of SSH (Secure Shell), which encrypts the entire session.

Similar to the console, you will configure the VTY lines to use the local user database. The process is nearly identical, but with one extra crucial step: specifying SSH as the only allowed transport protocol.

This image contrasts two VTY configurations. On the left is the insecure method using a single shared password. On the right is the recommended, secure method using `login local`, which prompts for both a username and password from the local database.

The following video provides a concise summary of all the steps needed for a secure SSH setup, including the VTY line configuration.

Free CCNA | SSH | Day 42 | CCNA 200-301 Complete Course

This segment summarizes the end-to-end process for configuring secure SSH access on a Cisco device.

Watch the SSH configuration summary from the SSH setup. While it covers prerequisite steps like setting a hostname and generating crypto keys (which are essential for SSH to work), focus on the VTY line commands: login local and transport input ssh.

The VTY configuration is as follows:

! Assuming a user is already created
! Configure all 16 VTY lines (0 through 15)
R1(config)# line vty 0 15
R1(config-line)# login local
R1(config-line)# transport input ssh  ! This is critical - it disables Telnet
R1(config-line)# exec-timeout 5 0

4. Practical Lab: Configuration and Verification

Now it's time to put this all together. The following video is a short, guided lab that walks you through creating users and securing the console line with login local. Follow along to solidify your understanding of the process and the result.

FREE CCNA Lab 010: Local Username/Password Database

This lab video from Jeremy's IT Lab provides a practical walkthrough of creating local users and applying them to the console line.

First, watch the section where users are created. Next, see how login local is applied to the console. Finally, the video demonstrates an interesting practical detail by testing case sensitivity. You'll see that usernames are not case-sensitive, but passwords are.

After configuring device access, you must verify that it works as expected. Here are the most important commands to use:

  • show running-config | section username: Displays all the local user accounts created on the device. Verify that the passwords are encrypted (they will be if you used the secret keyword).
  • show running-config | section line: Shows the configuration for all lines (console, VTY, aux). Use this to confirm that login local and transport input ssh are correctly applied.
  • show users: Displays who is currently logged into the device and via which line. This is useful for active monitoring.

For a quick reference on these commands and common mistakes to avoid, review the final sections of the "Lines and local user authentication" article.

Lines and local user authentication - Learn Tech From Zero

This part of the article provides essential verification commands and a summary checklist.

Quickly read through: "Verifying Line and Authentication Configuration" "Common Exam Mistakes to Avoid" "Exam Summary (Must-Remember Points)"


Conclusion

Congratulations on completing this final lesson! You have now mastered a fundamental aspect of network device security: controlling administrative access. By replacing insecure, shared passwords with individual local user accounts, you enhance both security and accountability.

Key Takeaways:

  • Use Local Users: Always create individual user accounts with the username <name> secret <password> command for secure, accountable management.
  • Secure All Lines: Apply the login local command to both line console 0 and line vty 0 15 to enforce authentication against the local user database.
  • Enforce SSH: On VTY lines, always use transport input ssh to disable insecure Telnet and ensure all remote management traffic is encrypted.
  • Use Timeouts: Configure exec-timeout on all lines to protect against sessions being left open on unattended terminals.
  • Verify Your Work: Use show running-config and show users to confirm your security settings are active and correct.

Over the past set of lessons, you've covered a range of critical CCNA topics, from Layer 2 switching and VLANs to essential security features like port security, DHCP snooping, and now device access control. This knowledge provides a solid practical foundation for the hands-on project you are working on. Good luck