recursive operations in sftp

Damien Miller djm at
Tue Dec 7 14:24:14 EST 2004

Chase Phillips wrote:
> Andrew Mortensen wrote:
>>If modified fts is required, I'm interested in at least hearing what 
>>those modifications would need to be.
> Maybe you're not suggesting this, but it's my understanding the best 
> path to 'get -r' isn't to change the fts family of functions to receive 
> a local call and then traverse a remote directory tree, but instead to 
> port the fts family of calls into openbsd-compat and mirror the 'put -r' 
> code for 'get -r' commands on the server-side.  (That is, pass the fts 
> system calls and arguments down the pipe from sftp to the sftp-server a 
> la remote_glob.)

I don't think that placing responsibility for globbing an recursion in
the server is a good idea. For a start, it would be a protocol extension
that no one else would have (initially at least). Secondly, it isn't
necessary anyway.

> This also has the benefit of giving fts functionality to more platforms. 
>   fts didn't work natively on some other OSs (eg RH9) last year.  Has 
> the availability of the functions changed in that time to be more widely 
> supported?

My suggestion was to use a locally modified fts() function that had
hooks to use caller-specified stat, opendir, readdir, etc. functions -
much like the glob() extensions.

Since I'm not aware of an extant, free fts() that has this, we would
have to keep a local copy in OpenSSH - so you needn't worry about
platform support.


More information about the openssh-unix-dev mailing list