Search code examples
.htpasswdswupdate

How to configure basic authentification with htpasswd on moongoose swupdate webserver?


I put in this configuration for my SWUPDATE webserver:

SWUPDATE_WEBSERVER_ARGS=" -r /srv/swupdate/mongoose-webapp -p 8081 --auth-domain 'SWUpdate' --global-auth-file /home/swupdate-cred/.htpasswd "

I now get the authentication popup when I try to access port 8081 .

I tried putting the username and password I created with this command here:


      htpasswd -c /home/swupdate-cred/.htpasswd ckm

But it never lets me log in, with the user and pw I configured...

i don't understand, should i create users in a certain way? with the specified domain? help

I use SWUpdate v2023.05.0


Solution

  • I have resolved the issue:

    You need to create the password by specifying the realm as follows:

    htdigest -c .htpasswd realmyouwanttoset username_setted 
    Enter password: pwfantasy 
    Retype password: pwfantasy 
    

    Then, you can set the arguments as shown below:

    SWUPDATE_WEBSERVER_ARGS=" -r /srv/swupdate/mongoose-webapp -p 8081 --auth-domain realmyouwanttoset --global-auth-file /whereyourfileis/.htpasswd " 
    

    Basic authentication configured successfully. 📈📈