- 10 Oct 2024
- 1 Minute to read
- Print
- PDF
Change Password for a User
- Updated on 10 Oct 2024
- 1 Minute to read
- Print
- PDF
The following script helps IT Admins to change the password for a local user on Linux machines.
Copy and save the contents below to a UTF-8 editor like notepad++ OR Sublime Text in Windows or gedit in Ubuntu.
If you are using notepad++ then use the bottom right panel to change the type to Unix (LF).
Or click here to download the file.
#!/bin/bash # User whose password need to be changed username="SET_USERNAME" # # New Password. # Please ensure this password complies with password policy that is # set on device password="NEW_PASSWORD" echo "$username:$password" | chpasswd echo "Password changed for user: $username"
Replace the below Placeholders in the script before uploading it on the dashboard:
SET_USERNAME: Username for which the password has to be changed
NEW_PASSWORD: New password for the user
Follow our guide to upload & publish the script using Scalefusion Dashboard.
Notes:
Some of the scripts and their contents are sourced from internet and yes, our new friend ChatGPT.
Please validate the scripts on a test machine before deploying them on all your managed devices.
Scalefusion has tested these scripts, however Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the usage of these scripts.