Answer the question
In order to leave comments, you need to log in
How to remotely reboot Grandstream GXP2200 every day?
I have a network where everything is distributed over VLANs, there is an Asterisk server and IP phones, of which 5 Grandstream are with the leaders, the phones are visible only to Asterisk. The task is this, you need to reboot these 5 Grandstreams every day, but the phone itself does not have such a function, but there is a reboot method via SSH with a simple reboot command. But there is a small problem with the script, since Asterisk is installed on Centos 5.2, where updates and installation of packages are strictly prohibited, I cannot use expect and sshpass.
What methods do you recommend?
Thanks in advance everyone.)
Answer the question
In order to leave comments, you need to log in
In such a situation, it might work with such a "hack". Once upon a time they used it on a project in a somewhat similar situation.
First you need to create a script that displays the password using echo
#!/bin/sh
echo "secret_Grandstream_pass"
chmod u+x /home/root/grandstream_pass
#!/bin/sh
# Заставляем ssh считать что у нас нет дисплея, что поспособствует тому, что ssh Не будет запрашивать пароль
export DISPLAY=:0
# Тот самый скрипт с паролем
export SSH_ASKPASS=/home/root/grandstream_pass
# Выполняем ssh. setsid создаст новый сеанс без контролирующего терминала, что так же способствует тому, чтобы ssh не запросил пароль
setsid ssh [email protected] "reboot"
DISPLAY=: SSH_ASKPASS=/home/root/grandstream_pass setsid ssh [email protected] "reboot"
или
echo nothing | DISPLAY=: SSH_ASKPASS=/home/root/grandstream_pass ssh [email protected] "reboot"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question