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 given permissions but not created user


sudo chown root:root filename



Thanks

On Wed, Jul 27, 2016 at 1:18 PM, bitfreak <bitfreak25@xxxxxx> wrote:

As I tried this on Linux, the problem was related to the permission-rights. The mosquitto_passwd write a tmp-File, that could not be written, if it has no permission. You can create this file and give him the permissions. But as I said, I hardly recommend the way with mosquitto-auth-plugin or another more secure way.


Am 27.07.2016 um 07:23 schrieb Srinivas Pokala:
HI,

mosquitto_passwd -b /etc/mosquitto/passwd guest1 121212

working in command line, not in php exec() function.

Thanks
Srinivas

On Tue, Jul 26, 2016 at 6:28 PM, Kees Nuyt <k.nuyt@xxxxxxxxx> wrote:
On Tue, 26 Jul 2016 17:30:23 +0530, you wrote:

>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: )


You probably have to add the -b option.

man mosquitto_passwd

  -b   Run in batch mode. This allows the password to be
provided at the command line which can be convenient but should
be used with care because the password will be visible on the
command line and in command history.



>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 listmosquitto-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visithttps://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
>>

--
Regards,

Kees Nuyt

_______________________________________________
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


_______________________________________________
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