Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl Net::SFTP::Foreign put() file size zero

Status
Not open for further replies.

007angkor

Programmer
Feb 6, 2012
1
AU
thread219-1461944

Hey,

It is my first time using Net::SFTP::Foreign and I found it strange behaviour when I tried to 'put' the file on remote server. If the file already exist on remote server and owned by 'me' I got successfully result, however if the file own by other userID (but I am in that group, meaning I have permission to read/write to the file) I got file size zero length. Can someone please help me to result this issues? Many thanks.

 
That probably happens because Net::SFTP::Foreign is not able to change the permissions of the file.

Try as follows:

$sftp->put($file, $dest, copy_perm => 0, copy_time => 0)
or die $sftp->error;
 
Wanted to add that I also had to edit /usr/local/share/perl5/Net/SFTP/Foreign/Backend/Unix.pm
and give $buffer an initial value (4096)

Otherwise sftp->put would throw an error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top