3

I want to copy the file from remote host to the local host with the preservation of file permission, hence i tried to use the 'copy_perm' option as per the documentation of Net::SFTP::Foreign as mentioned below -

my $sftp = Net::SFTP::Foreign->new(
    host      => $host,
    key_path  => $ssh_key_path,
    copy_perm => 1,
    more      => [ -o => 'Compression yes' ]
);

But I am getting the below error -

Invalid option 'copy_perm' or bad combination of options at test.pl at line 101.

The line 101 is the Net::SFTP::Foreign object creation as mentioned above. Did i miss anything or anyone has faced same issue before?

Jim Davis
  • 5,241
  • 1
  • 26
  • 22
CodeQuestor
  • 881
  • 1
  • 11
  • 25

1 Answers1

2

That's because copy_perm isn't an option for the new method. You use it in get and put.

Jim Davis
  • 5,241
  • 1
  • 26
  • 22
  • I have copied the file from system1 to system2, but the uid and gid are not still same even i used 'copy_perm' = > 1 while using get() methods. I am checking the files using 'ls -ln' command. The only difference is that i am logged in destination system(system2) as a root user and it shows something like, root@system # ls -n /dest/files -rw-r--r-- 1 0 0 4424 Jun 10 04:45 /dest/files/file.txt ... While at source side it has uid and gid like - -rw-r--r-- 1 1001 1002 4424 Jun 10 04:45 /dest/files/file.txt – CodeQuestor Aug 11 '15 at 04:16