Hi,
the sftp client from openssh package can't upload data from local pipe
to remote file. For example, such a command fails:
$ cat file | sftp -b <(echo 'put /dev/stdin /directory/filename') -i ~/.ssh/key user@remote.host
sftp> put /dev/stdin /directory/filename
/dev/stdin is not a regular file
What is a purpose for such a behaviour and limitation? As experiment,
I removed following piece of code which is responsible for this check
(sftp-client.c, do_upload() function):
if (!S_ISREG(sb.st_mode)) {
error("%s is not a regular file", local_path);
close(local_fd);
return(-1);
}
and nothing bad happened. It was still possible to upload regular files,
but additionaly there was an opportunity for upload data piped from other
command (what in my opinion is very useful feature) and even directly
from terminal. Would it be possible to remove this restriction from sftp
client?
Regards.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
the sftp client from openssh package can't upload data from local pipe
to remote file. For example, such a command fails:
$ cat file | sftp -b <(echo 'put /dev/stdin /directory/filename') -i ~/.ssh/key user@remote.host
sftp> put /dev/stdin /directory/filename
/dev/stdin is not a regular file
What is a purpose for such a behaviour and limitation? As experiment,
I removed following piece of code which is responsible for this check
(sftp-client.c, do_upload() function):
if (!S_ISREG(sb.st_mode)) {
error("%s is not a regular file", local_path);
close(local_fd);
return(-1);
}
and nothing bad happened. It was still possible to upload regular files,
but additionaly there was an opportunity for upload data piped from other
command (what in my opinion is very useful feature) and even directly
from terminal. Would it be possible to remove this restriction from sftp
client?
Regards.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev