[paramiko] scp not sftp

James Bardin jbardin at bu.edu
Wed May 23 11:57:37 PDT 2007



Rafael Ugolini wrote:
> James Bardin wrote:
>   
>> That's great! I tried this a while back and never got it working.
>> I also noticed that putty's scp looks like it first tries to use sftp 
>> for the transfer.
>>
>> FYI, you can format the mode like:
>> mode = os.stat(path).st_mode
>> 'C%s' % oct(mode)[-4:]
>>
>> If you import the stat module you can also:
>> mode = os.stat(path).st_mode
>> 'C%s' % oct(stat.S_IMODE(mode))
>>
>> Do you know what the 1 is for in the file info line?
>>     
> hmm, i don't remember why i put it there, but i was reading some docs and
> they were using something like
>
> scp -v -t .
> C0664 "size" "filename"
>
>
>   
I was trying to read through the source of openssh scp.c (my c skills 
aren't much), and it looked like the "1" was a flag for last_file, for 
multiple file transfers.
Maybe it's used with "scp -r -t directory" for recursive transfers.


A patch like this would work fine against current openssh servers too. 
It seems openssh is still using the scp1 protocol, and the command that 
it issues on the other end is "scp -t ."  It's only SSH2 (with scp2) 
that is incompatible.

-jim





More information about the paramiko mailing list