Call sshpass from Asterisk Dialplan

Hi,

I use already some scripts with Asterisk with no problem, but if I use a bash with an sshpass command It not work, the script has no problem launching it from console.

I have no idea! Thanks!

Hi HsDev,

Hardly anyone will reply to this message - you have not provided any details.
Please post your script here and the section of your dialplan where you call this script.

In any case, the detailed description of the scenario and issue is needed.

Hi,

with realtime (database row) mode I call the script in this way:
…‘System’, ‘/bin/bash /home/pi/folder/scriptbash1’

scriptbash1:
sudo sshpass -p ‘pass’ ssh pi@x.x.x.x ‘sudo bash /home/pi/folder/scriptbash2’

Thanks.

Does the asterisk user/group have sudo privileges?
The default shell for the asterisk user is: /sbin/nologin

Try running your command as the asterisk user:

[root@server]# su asterisk
[asterisk@server]# sudo sshpass -p ‘pass’ ssh pi@x.x.x.x ‘sudo bash /home/pi/folder/scriptbash2’
asterisk is not in the sudoers file. This incident will be reported.

I never heard of sshpass, I would probably use public/private keys to execute commands on a remote system.