Thread: [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 15:47:43
|
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 |
From: Tim P. <tim...@yo...> - 2014-01-15 17:16:08
Attachments:
Attached Message Part
|
------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk |
From: Nigel R. <ni...@sy...> - 2014-01-15 17:22:45
|
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 |
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 |
From: Salvador F. <sfa...@ya...> - 2014-01-15 20:23:48
|
>________________________________ > From: Tim Pushor <tim...@yo...> >To: ssh...@li... >Sent: Wednesday, January 15, 2014 4:32 PM >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 > Maybe you could switch to Net::SFTP::Foreign which provides support for such server behaviour via the late_set_perm and best_effort options or just dissabling the permission copying setting copy_perm to 0 |