Asheeown Posted August 19, 2009 Share Posted August 19, 2009 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 More sharing options...
msinternet Posted August 19, 2009 Share Posted August 19, 2009 Hi, why not just use comand line stuff like scp etc. If it is a one time thing why not just download and reupload to the other server. Martin Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902179 Share on other sites More sharing options...
Asheeown Posted August 20, 2009 Author Share Posted August 20, 2009 Not a one time thing. Migration script for linux servers, this is for the home directories. Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902237 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 Still, any reason you need to use php for this? Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902254 Share on other sites More sharing options...
Asheeown Posted August 20, 2009 Author Share Posted August 20, 2009 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. Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902454 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 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? Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902461 Share on other sites More sharing options...
Asheeown Posted August 20, 2009 Author Share Posted August 20, 2009 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? Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902488 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 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. Link to comment https://forums.phpfreaks.com/topic/171047-transfer-linux-directories-using-php/#findComment-902490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.