Jump to content

Transfer linux directories using PHP


Asheeown

Recommended Posts

I am trying to transfer all directories fully intact with all files from one server to another.  I have the IP and root password but RSH and RSYNC both don't have password definitions.  I am also using ssh2 so I have access to the ssh2_sftp command for both servers.

 

Is there anyway to do this?

Link to comment
https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/
Share on other sites

Because that's what I am doing it in.  It's part of a project I am doing for myself, a nice batch of admin tools.

 

I don't see why it's relevant that you need to know the reason why I am using PHP.

 

It can be done using SSH key files for password free access but that's just annoying and all I am simply asking is if maybe ssh2_scp_recv or send can be looped from a directory listing to copy everything in structure.

Because that's what I am doing it in.  It's part of a project I am doing for myself, a nice batch of admin tools.

 

I don't see why it's relevant that you need to know the reason why I am using PHP.

 

It can be done using SSH key files for password free access but that's just annoying and all I am simply asking is if maybe ssh2_scp_recv or send can be looped from a directory listing to copy everything in structure.

 

Don't get so uptight, I was simply asking if there was a valid reason for using php, its pretty obvious that there are better tools for the job is all.

 

Ive not used any of php's ssh functions so can't really help much, have you tried looping through a few calls to ssh2_scp_recv  to see what the results are?

I haven't really gotten a successful execution of scp_recv, and it's because I don't really understand how to use it.  It only allows for one ssh connection handler but I have two, one for each server, so which connection handler do I run it for the source or destination.  Also, what would I do for the paths to get the file from the other server.  Like if I used the source connection handler to run scp_recv how would I tell it where to put the file on the remote server?

As I said, Ive never used php's ssh extension. The way I read the manual though, ssh2_scp_recv is for requesting a file, while ssh2_scp_send is for sending a file.

 

The process (one would assume) would be the same as it would be using scp itself. ie; When requesting a file you would need to know where that file resided on the remote machine. Same as to send a file you need to know where it resides locally.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.