Changing your own account password using the CLI

Prev Next

Use the CLI commands in this topic to change the password on your own account.

If you are required to enter your current password when you change your password, you can do this in two different ways:

  • You can specify your password interactively by entering the command and then entering your current password after the CLI prompts you.

  • You can specify your password inline by including it as a command option.

If you enter an invalid current password, you must wait three seconds before trying again.

You can set a password with an encrypted string by specifying the hashed string in the command.

Caution

If your role is Monitor, Analyst, or Auditor, you can change your own account password, but you cannot save the changes. This is because your role does not permit committing system changes. Your password changes could be lost if an administrator reboots without saving changes or reverts to the last saved configuration.

Only Administrators and Operators are allowed to save system changes.

Prerequisites
  • Any role

To change the password on your own account:
  1. Log in to the CLI as yourself.

  2. Go to CLI configuration mode:

    hostname > enable
    hostname # configure terminal
  3. Change your password.

    Use this command to set a cleartext password:

    username <username> password <password>

    For example:

    hostname (config) # username tsmith password 12345!@#$%AbCdE

    If you are required to enter your current password when you change your password:

    • To enter your current password interactively, enter your current password when prompted.

      For example:

      hostname (config) #username <username> password <password> Current password:678910!@#$%FgHiJ
    • To enter your current password inline, use the following command:

      username <username> password <password> curr-password <currentPassword>

      For example:

      username tsmith password 12345!@#$%AbCdE curr-password 678910!@#$%FgHiJ

    Use the following command to set your password with an encrypted string:

    username <username> password 7<encrypted-password>

    For example:

    hostname (config) # username tsmith password 7 $6$iWtdrQBA$eaJzOvEERGSgYezdnvZ4cU0vMhbBziMtRPfUe7INU8qD9xo0WUCfaF/LqkJ4agxo1kJj2kXYuWUGY00qeslJ5.

  4. (Operator role only) Save your changes:

    hostname (config) # write memory

Example

In this example, Marie changes her password and then displays her account information two ways.

hostname (config) # username marieb password 12345!@#$%AbCdE
hostname (config) # show usernames user marieb
Local username:         marieb
Full name:
Account status:         Password set
Role:                   operator

VLAN:                   not set
Subnet:                 not set

Password last set:      2017/01/09 21:28:13
Password age:           20 days 12 hr 17 min 50 sec
Password expires:       in 69 days 23 hr 58 min 20 sec
Must change password:   no

hostname (config) # show whoami
Username:               marieb
Local username:         marieb
Full name:           
Account status:         Password set
Role:                   operator

VLAN:                   not set
Subnet:                 not set


Password last set:      2017/01/09 21:28:13
Password age:           20 days 12 hr 17 min 55 sec
Password expires:       in 69 days 23 hr 58 min 15 sec
Must change password:   no

Login time:             2017/01/09 21:27:54.002
Auth method:            local (password)
Remote address:         10.10.0.0
Line:                   pts/1
Session ID:             25614