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
  • 8,144
  • 10
  • 29
  • 40
Ecila
  • 57
  • 1
  • 4

0 Answers0