Wago user creation via command line (User management)

I’m looking into setting up a user via a script without having the user manually set a new password. Normally, I’d go through these steps:

  1. Create the user
useradd -m testuser
  1. Set the password for the user
passwd testuser

The only issue is that this initiates the following prompt:

image

Is there a way to have a section of script that would automatically set the password? I’ve tried a few commands but it doesn’t seem to work.

Thanks in advance for the help!

Are you trying to execute from the controller itself or remotely ?
If the script is executed remotely, you can take a look to “expect”
https://linux.die.net/man/1/expect

Otherwise you can use the script of the config-tools used by the WBM :

/etc/config-tools/config_user user=admin new-password=mypassword confirm-password=mypassword old-password=wago

1 Like

Is it possible to add this new user to one of the existing groups?

I don’t know for the config-tools script but with useradd yes :

useradd admin2 --groups wbmadmin, admin
passwd admin2

This will create an admin2 user which will be able to connect to WBM (because it belongs to wbmadmin) and SSH (because it belongs to admin group)

1 Like

Could try chpasswd, with pipe e.g.

echo ‘testuser:newpassword’ | sudo chpasswd

chpasswd command is unfortunately not supported on WAGO controller.

Thanks! I was able to add the user to a group with usermod -a -G groupname username

Additionally, I was informed that you can edit /etc/groups to add a user to a group. A reboot is then required.

1 Like