Allow SSH But Only Set Password No Username

I use the command
enable password cisco
line vty 0 4
transport input ssh
Do I need a username and password to get into my switch then?
enable password cisco
line vty 0 4
transport input ssh
Do I need a username and password to get into my switch then?
Comments
The `line vty 0 4` command selects virtual terminal lines for remote console access (such as SSH or Telnet). `transport input ssh` restricts these lines to only accept SSH connections.
However, you haven't set a password for the VTY lines or specified that a login is required. Therefore, as is, anyone could SSH into the device without needing any username or password.
To require a password for SSH access, you could add these lines to your configuration:
password cisco
login
transport input ssh
This would require the password "cisco" for SSH connections. However, this is still not the best practice from a security perspective as it doesn't require a unique username for each user.
line vty 0 4
login local
Forum Admin at www.techexams.net
--
LinkedIn: www.linkedin.com/in/jamesdmurray
Twitter: www.twitter.com/jdmurray
line vty 0 4
login
I specify username and password but telnet only requires password.
What happens if I do this?
line vty 0 4
login
transport input ssh
There is no password but ssh is allowed. I believe that ssh requires both username and password. Am I right to say this?
If you want to use the local username and password, you would need to use `login local`. If you want to use Telnet with just a password and not a username, you can set a password on the VTY lines like so:
line vty 0 4
password cisco
login
transport input telnet
SSH does indeed require a username and password. However, in your configuration, you've enabled SSH but have not provided a password for the VTY lines, nor have you provided a local user database using the `username <username> password <password>` command.
ip domain-name yourdomain.com
crypto key generate rsa
!
username admin password cisco
!
line vty 0 4
login local
transport input ssh
In this example, replace `yourdomain.com` with your domain name, `admin` with your desired username, and `cisco` with your desired password. Note that it's important to choose a strong, unique password.
With this configuration, users will be able to SSH into the device using the username "admin" and the password "cisco".
Forum Admin at www.techexams.net
--
LinkedIn: www.linkedin.com/in/jamesdmurray
Twitter: www.twitter.com/jdmurray