Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] How to create users using php or javascript in mosquitto

Hi,

I use this code:

$userName = "srinivas";
$RndPsw  = "123456";
try{           
    $command = "mosquitto_passwd -c /etc/mosquitto/passwd ".$userName." ". $RndPsw ;
    exec($command , $out );
    print_r($out);
}catch(Exception $e){   
    echo $e;  
}
but not working getting empty response and user not created

when i execute only this command = "mosquitto_passwd -c /etc/mosquitto/passwd ".$userName, getting response

Array ( [0] => Password: )

help me

Thanks
Srinivas



On Tue, Jul 26, 2016 at 5:01 PM, Carmelo G. <web@xxxxxxxxxx> wrote:

Hi

i use this code in php

$userName = "myUsername";
$RndPsw  = "myPassword";
               
$command = "mosquitto_passwd -b /var/www/MQTT/users ".$userName." ". $RndPsw ;
exec($command , $out );
$mystring = "mosquitto";
exec("ps aux | grep \"${mystring}\" | grep -v grep | awk '{ print $2 }' | head -1", $out); // find process
exec("kill -1 " .$out[0]);  // reset mosquitto


On 07/26/2016 12:49 PM, Srinivas Pokala wrote:
Hi,

Username successfully created using linux command with:  "mosquitto_passwd /etc/mosquitto/passwd guest".

I need to create same with php or _javascript_ how?

Thanks
Srinivas


_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top