Reset remote user password and update it in Ezeelogin
How to reset the user password on a remote server and update it in Ezeelogin?
How to reset the user password of a remote server and update it?
1. Log in to the remote server and execute the following command. It will prompt you for a password, enter the new password to update it.
username@remote_server ~]# passwd username
New password:
Retype new password:
passwd: password updated successfully
2. Login to Ezeelogin GUI and update the new password in the SSH password field.
How to reset the user password on all remote servers and update it?
1. Login to the ezsh shell and run the below command in the parallel shell to update the password for a user in the server group. Replace your username and password.
[group:production server]# echo 'username:password' | sudo chpasswd
2. Export the server list using the command below and enter the super admin's password when prompted.
root@gateway ~]# php /usr/local/ezlogin/ezxport.php servers.csv
Enter the Ezeelogin administrator password:
3. Extract only the necessary fields from the exported server list file using the following command.
root@gateway ~]# tail -n +2 servers.csv | tr -d '"' | cut -d ',' -f 1,5 > servers.txt
4. Create a Bash script to update new passwords for all servers. Replace the API URL, API secret, and password variables with the correct values.
Refer detailed article to add/delete/update servers in GUI using Ezeelogin API.
root@gateway ~]# vim password_update_script.sh
#!/bin/bash
API_URL="http://192.168.1.38/ezlogin"
SECRET="zxcvbnm"
PASSWORD="12345"
while IFS=',' read -r NAME SSH_PORT; do
php /usr/local/ezlogin/ezwapi.php update_server -api_url "$API_URL" -secret "$SECRET" -name "$NAME" -password "$PASSWORD" -ssh_port "$SSH_PORT"
done < servers.txt
5. Execute the script, and the new password will be updated on all remote servers.
root@gateway ~]# sh password_update_script.sh