0

I have to use PHP to execute a shell command, in that case scp between 2 server, with shell_exec or exec.

$cmd="scp root@ip1:/dir/filename \ root@ip2:/dir/";
shell_exec(cmd);

When used in the shell, it asks me for the password to connect to the destination server. How can I do this within PHP? Where can I put the password? And in the case of the command above, the passwords for servers ip1 and ip2.

Nic3500
  • 6,706
  • 10
  • 30
  • 37
Ecila
  • 59
  • 4

0 Answers0