dovecotpw returns different hash when used the $ symbol

111 Views Asked by At

I tried in PHP via SSH to generate password with the command dovecotpw and if the password contains the $ sign symbol than it generates different hash from the hash the dovecotpw generates in command line.

here is the line that generates the password:

echo $ssh->exec('dovecotpw -s CRAM-MD5 -p test$test');
1

There are 1 best solutions below

1
On BEST ANSWER

The remote shell is using the $ to denote a shell variable. Escape the argument.

...('... \'test$test\'');