Re: [Ssh-sftp-perl-users] ERROR:SFTP->put died: Couldn't fsetstat: Permission denied
Brought to you by:
dbrobins
|
From: Tim P. <tim...@yo...> - 2014-01-15 17:16:16
|
Hi Nigel,
Thanks for responding but I can't see where that would work.
in the ->put method it looks like it takes the file attributes from the
local file via stat, and tries to set at least some of them (uid/gid?)
on the remote file after transferring. I don't see a way to override
this behavior as a lowly module user. I would like the capability to
turn this off. This is the code in question:
my @stat = stat $local or croak "Can't stat local $local: $!";
my $size = $stat[7];
my $a = Net::SFTP::Attributes->new(Stat => \@stat);
my $flags = $a->flags;
$flags &= ~SSH2_FILEXFER_ATTR_SIZE;
$flags &= ~SSH2_FILEXFER_ATTR_UIDGID;
$a->flags($flags);
$a->perm( $a->perm & 0777 );
... do transfer ...
$sftp->do_fsetstat($handle, $a); *<- This fails*
$sftp->do_close($handle);
return 1;
I'm not sure exactly what its trying to set, but looks like at least
UID/GID and perhaps setting perms to 0777. The remote server does not
allow this, and the command line sftp client does not seem to do this.
On 1/15/2014 10:04 AM, Nigel Reed wrote:
>
> Maybe you need to use Net::SFTP::Attributes to change the permissions.
>
> $attrs->perm( [ $value ] )
>
> Get/set the value of the permissions in $attrs.
>
> *From:*Tim Pushor [mailto:tim...@yo...]
> *Sent:* Wednesday, January 15, 2014 9:33 AM
> *To:* ssh...@li...
> *Subject:* [Ssh-sftp-perl-users] ERROR:SFTP->put died: Couldn't
> fsetstat: Permission denied
>
> Hello list,
>
> Using Net::SFTP 0.10 to automate transferring files to one of our
> vendors has produced this error:
>
> SFTP->put died: Couldn't fsetstat: Permission denied
>
> I've commented out the $sftp->do_fsetstat($handle,$a) line from
> SFTP.pm and the file goes. I believe this is due to the overly
> restrictive environment our vendor has set up. I didn't look too close
> but it looks like the fsetstat is trying to set the file permission
> bits to 0777.
>
> Is there any way to perhaps get an option put into this module to be
> able to disable this behavior? I do not want to leave the system like
> this as module upgrades will break the script again. I can't be the
> only one that will trip over this.
>
> Thank you,
>
> --
>
> Tim Pushor
>
> York Electronics Ltd.
>
> Information Technology
>
> Phone: 403.207.0202 x243
>
> Mobile: 403.978.6502
>
--
Tim Pushor
York Electronics Ltd.
Information Technology
Phone: 403.207.0202 x243
Mobile: 403.978.6502
|