Which of the following statements is true regarding the autocommand keyword when used with the username command on Cisco routers? (Select the best answer.)
- The specified command cannot exceed 255 characters.
- The autocommand keyword must be the username command’s last argument.
- The specified command cannot contain embedded spaces.
- The user session is not terminated if the autocommand keyword fails to execute its specified command.
When the autocommand keyword is used with the username command on a Cisco router, it must be the last commandline argument specified. The username command creates and configures entries in a router’s local authentication database. The usernamecommand requires a user name as its main argument? the user name must be a single string of text without blank spaces or quotation marks. There are a number of keywords that can be used with the username command to customize user characteristics, such as passwords, privilege levels, and automatic commands. The autocommand keyword configures a command that will execute immediately after a user successfully logs in to a Cisco router. The command specified by the autocommand keyword can be of any length and can contain embedded spaces. Because the command can be of any length, the autocommand keyword must be the username command’s last argument. The username command can accept multiple arguments, such as the password and privilege keywords, on a single command line. Alternatively, each keyword can be specified with the username command on its own line. For example, the username boson password cisco privilege 15 autocommand show process cpu historycommand is equivalent to the following block of commands:
RouterA(config)#username boson password cisco
RouterA(config)#username boson privilege 15
RouterA(config)#username boson autocommand show process cpu history
The sample command block configures a user name of boson with a password of cisco, configures a privilege level of 15, and causes the EXEC shell to execute the show process cpu history command after the user successfully logs in to the router. If the command is successful, the output will be displayed on the user’s terminal and then the session will be automatically disconnected. However, if the command fails to execute, only an error message will be displayed on the user’s terminal before the session is automatically disconnected. Because the user session is disconnected by default after the output from the autocommand keyword is displayed, you must use the nohangup keyword if you intend to change the default behavior and leave the user session intact.