Updating local accounts password
See original GitHub issueHi,
I am trying to update the local account on all of my Juniper and some Cisco devices, but I could not get this to work. I did not get an error and I got the print at the end of the for loop. When I logged in to any of the device 10.1.1.1, the account I was using for testing, the password did not change.
from netmiko import ConnectHandler
import getpass
junos_list = ['10.1.1.1']
username = input("Username : ")
password = getpass.getpass("Password : ")
print("Enter the account you would like to update")
local_user = input("Local account username : ")
new_password = input ("Enter the new password : ")
#Juniper device root account
if (local_username == "root") and (username == "admin"):
for i in junos_list:
userssh = ConnectHandler(device_type='juniper_junos', ip=i, port=22, username=username, password=password)
root_login_cred = ('set system root-authentication plain-text-password')
root_login_passwd = (new_password)
root_login_confirm_passwd = (new_password)
userssh.send_config_set(root_login_cred)
userssh.send_config_set(root_login_passwd)
userssh.send_config_set(root_login_confirm_passwd)
userssh.disconnect()
print("\n\tThe root password has been updated for", i)
else:
for la in junos_list:
userssh = ConnectHandler(device_type='juniper_junos', ip=la, port=22, username=username, password=password)
la_login_cred = ('set system login user ' + local_user + ' authentication plain-text-password')
la_login_passwd = (new_password)
la_login_confirm_passwd = (new_password)
config_commands = ([la_login_cred, la_login_passwd, la_login_passwd])
userssh.send_config_set(config_commands)
userssh.send_config_set(la_login_passwd)
userssh.send_config_set(la_login_confirm_passwd)
userssh.commit()
userssh.disconnect()
print("\n\tThe password has been updated for node", la)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Change local account password in Windows 10
Press Windows key + R. · Type netplwiz and hit Enter. · Under User account windows, select the User Profile for which you...
Read more >How to change your account password on Windows 10
In this guide, you'll learn the steps to change your account password on Windows 10, whether you're using a Microsoft or local account....
Read more >How do I change a local user account password?
Type Control Panel in the Cortana/Search box. Open Control Panel and click on User accounts. My Computers.
Read more >How to Change Another User's Password in Windows - Lifewire
Windows 11, 10 & 8: Go to Control Panel > User Accounts > User Accounts > Manage another account > [user]. Select Change...
Read more >How to reset a Microsoft Account password for Windows 10 or ...
Update Windows 10 local account security questions · At the desktop, press the Windows key and type "sign." Select Sign-in options from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ktbyers, Thanks for the quick response. Will do.
Meanwhile, i found a work around for this. Junos has a hidden command ‘plain-text-password-value’ that allows you to enter the password on the same line and avoid the password prompt.
source: https://www.reddit.com/r/networking/comments/9ptwte/python_and_junos
@dasiimwe You should open a new issue (or better would be a Netmiko Github discussion question).
Regards, Kirk