Hi Trying to send a file to another server using scp.. cannot use sftp as it is not installed on my server so i am getting a function not found for ssh2_connect.
So my only option as i can see it is scp. Now the problem come with i cannot include my password in the php scp script.
ie:
scp filename username:passwor@server:filename
It gives me the error that the server username doesn't exist If i use it without the password
scp filename username@server:filename
it prompts me for password
PS: I am testing the script in a command line on the localhost first as to get the error messages.
Any advice?
TA
If you can't use the SFTP binaries you could use phpseclib - a pure-PHP SFTP implementation:
Kevin, if you don't have the PHP SSH2 extension installed on your server then your best bet is to setup public/private key authentication on your other server if you have access. Then you can keep the private key on your PHP server, and pass -i on your scp command, something like this:
scp -i /var/www/htdocs/myphpproject/rsakey filename username@server:filename
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.