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)

2 Likes

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

Hello, can I send config_user with special charakcters. Somethink like /etc/config-tools/config_user user=admin new-password=xvFM%#2Xwr9 confirm-password=xvFM%#2Xwr9 old-password=wago. From wbm I can change pasword to xvFM%#2Xwr9 but from comadline it is not working…

Thanks

you can call from root:

passwd admin

or just

passwd

from admin account

also from config-tool (from root accout):

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

Hello, my problem is with particular characters like %,+,*… From WBM I can set this password and it is also working for WMB login but if I use it for cmd line then it is not working for WBM login. For ssh it working …

Thanks

Also passwd is not working for WBM login I have to use /etc/config-tools/config_user

it depends on FW version, because from FW20 linux users who are in a group “wbm-admin” or “wbm-user” can access wbm:

Thanks I have found it. And yes problem is on older fw particulary 18. From 20 I can use passwd.

In older fw some characters are changed before used in config_user

    // decode '%' and '+', because they have special meanings in the encoded characters

    $paramString = str_replace("%", "%25", $paramString);

    $paramString = str_replace("+", "%2b", $paramString);



    // decode characters in url format, which otherwise confuse the bash

    $paramString = str_replace(" ", "%20", $paramString);

    $paramString = str_replace("'", "%27", $paramString);

    $paramString = str_replace('"', "%22", $paramString);

    $paramString = str_replace('\`', "%60", $paramString);

    $paramString = str_replace('\*', "%2a", $paramString);

    $paramString = str_replace('$', "%24", $paramString);

Thanks for help.