Skip to Content

Error: User modify failed. Cannot modify user on other node: usermod: user luca does not exist.

Error: User modify failed. Cannot modify user on other node: usermod: user ’luca’ does not exist.


Overview: This article describes an error encountered on the Master node GUI when attempting to modify a non-existent user 'luca', with solutions including adding the user on the Slave node or following a script that helps you automate the creation of non-existent system users.


This error is received while modifying the user from GUI(Mater node).


  1. Add the user in the Slave node. Run the following command.

:~# useradd -K UMASK=0077 -m -s '/usr/local/bin/ezsh' -g 'ezuser' <username>

Ex: :~# useradd -K UMASK=0077 -m -s '/usr/local/bin/ezsh' -g 'ezuser' luca


       Alternative Method.

2. Delete the Gateway user(luca) from the Master node and create the same user from GUI.

Note:  You will lose user logs. 

Note: Script to add in all the missing users.

Create a bash script to automate the creation of system users based on usernames retrieved from a MySQL database table.

:~# vim usercreate_script.sh

!/bin/bash

# MySQL root password
sqlpass="YourMySQLRootPassword"

 

# Retrieve database and table names
db_name=$(awk -F ' ' '/db_name/ {print $2}' /usr/local/etc/ezlogin/ez.conf)
tbl_prefix=$(awk -F ' ' '/db_prefix/ {print $2}' /usr/local/etc/ezlogin/ez.conf)
tbl_name="${tbl_prefix}users"

 

# Retrieve usernames from MySQL
usernames=$(mysql -u root -p"${sqlpass}" -D "$db_name" -N -e "SELECT username FROM $tbl_name")

#Loop through each username and add the user if they do not exist
for username in $usernames; do
    if ! id -u "$username" >/dev/null 2>&1; then
        useradd -m -s /usr/local/bin/ezsh "$username"
        echo "Adding user $username to the system..."
    fi
done

And Execute the script.

:~# sh usercreate_script.sh


Related Articles:

Reset the User password and update in Ezeelogin.