G
G
G F2021-03-17 11:19:21
PHP
G F, 2021-03-17 11:19:21

How to make ssh client in php?

Hello. I'm trying to send a command to ssh like this -
$connection = ssh2_connect($host, $port);
ssh2_auth_password($connection, $login, $password);
$stream = ssh2_exec($connection, $cmd);
echo $stream;

But there is a problem, in commands like "apt-get upgrade" you need to accept "y" to continue the installation, so the scripts have their own commands that I need to send via ssh. How to accept "y" or execute a command in a script via ssh2. Maybe I didn't explain well...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Surzhikov, 2021-03-17
@Surzhikov

apt-get upgrade -y
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question