You can load a configuration snippet into IOS from a TFTP server, triggered over SNMP.
The steps are:
Warning:
This can seriously b0rk your equipment and I accept no responsibility if it doesn't work for you. If your device is thousands of miles away, running critical services and you cannot login then your network has bigger issues than bodging the username on this one device! Don't do this unless you understand the possible consequences of blindly applying raw config to a Cisco device.- Create a text file containing the config snippet.
- Run a TFTP server, on machine with IP 10.0.0.10 in this example.
- Set the value of iso.org.dod.internet.private.enterprises.cisco.lo cal.lsystem.hostConfigSet.10.0.0.10 to a string containing the filename from #2
The config snippet could be something like:
username cisco priv 15 password cisco
The command line for NET-SNMP tools snmpset is:
snmpset <router> <community> .iso.org.dod.internet.private.enterprises.cisco.local.lsystem.hostConfigSet.10.0.0.10 s <filename>
You can do a write mem via SNMP too if you want (but I wouldn't recommend it):
snmpset <router> <community> .iso.org.dod.internet.private.enterprises.cisco.local.lsystem.writeMem.0 i 1
If you can't login to a device and have absolutely no idea why not then it may not be as simple as adding a new local account. The specifics may be guessed at depending on how standardized your network is and you may be able to guess at the extra bits (heed the warning above), e.g.
no aaa new-model
username cisco priv 15 password cisco
line vty 0 15
login local
password cisco
username cisco priv 15 password cisco
line vty 0 15
login local
password cisco