Hi,
I am trying to use sftp in a ksh - Shell script, but not even a simple script like this returns not output:
sftp username@remotehost <<END
ls
END
If I do something like this:
sftp username@remotehost <<END | tee logfile
ls
END
I get this error message:
Warning: tcgetattr... (1 Reply)
HI
I need to write script to transefer files from windows server to UNIX and visa versa.... can any one enroute to the solution ........?
I am new to SFTP .. would requst you provide some helpful informaion, Basics of SFTP also appreciated
Thanks in Advance.
Madan (1 Reply)
Hi,
I want to retrieve files from an sftp site and place it a directory in unix server.
When I try to connect, it is asking password even if i hardcode it in the script.I want to automate the script. Could anyone tell me how to avoid password prompt.
#!/bin/sh
# sample automatic ftp script... (3 Replies)
Hi ,
I am able to manually connect to remote system usning "sftp" protocol. But when I using the below command in the script but I am not able to connect.
`sftp TEST01@120.34.3.4`
And the connection should not be closed after login. Please help to solve this.
Thanks
Satya (2 Replies)
did anyone knows a script to get a latest file in a folder,,i try to get the newest file at a folder via sftp and i want to make a crontab to do this once a day,,can someone give me the script to get the latest file?? (5 Replies)
I am sftp-ing to a server through a shell script from my local machine.
sftp user@host
put out.txt
bye
On executing the script, it prompts to enter the password, and after giving the password it successfully connects to the host.But the problem is that the remaining statements after the... (1 Reply)
Hi,
I have situation where i need to automate transferring 10000+ files using sftp.
while read line
do
if ; then
echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt
fi
done< files.txt
sftp -b sftpCommand.txt stu@192.168.2.1
The above... (1 Reply)
Hi all ,
can any one tell me how to run a script within a sftp session. let me tell u in bit clear way :
After I connected to sftp location , cd ing to some directory then I need to execute a one script. Please tell me if u have any idea on this .
Looking forward to your reply guys... (1 Reply)
Hi All,
Scenario : How to securely FTP the text file from a particular location(in unix system) to the windows ftp server (my PL is suggesting to use SCP command to accomplish this).
Detailed description:
I have created a Oracle job and scheduled it in dbms_scheduler. The job will invoke... (3 Replies)
Hi All,
I would be happy, if someone help me on this that I have only SFTP ID and Password to transfer some log files from webserver boxes to SFTP server
Anyone help me that how to pass the password parameter throough the shell scripts, since i don't have ssh login access on the SFTP... (2 Replies)
Discussion started by: l_gshankar24
2 Replies
LEARN ABOUT DEBIAN
libssh2_sftp_write
libssh2_sftp_write(3) libssh2 manual libssh2_sftp_write(3)NAME
libssh2_sftp_write - write SFTP data
SYNOPSIS
#include <libssh2.h>
#include <libssh2_sftp.h>
ssize_t libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle,
const char *buffer,
size_t count);
DESCRIPTION libssh2_sftp_write(3) writes a block of data to the SFTP server. This method is modeled after the POSIX write() function and uses the same
calling semantics.
handle - SFTP file handle as returned by libssh2_sftp_open_ex(3).
buffer - points to the data to send off.
count - Number of bytes from 'buffer' to write. Note that it may not be possible to write all bytes as requested.
libssh2_sftp_handle(3) will use as much as possible of the buffer and put it into a single SFTP protocol packet. This means that to get
maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function.
WRITE AHEAD
Starting in libssh2 version 1.2.8, the default behavior of libssh2 is to create several smaller outgoing packets for all data you pass to
this function and it will return a positive number as soon as the first packet is acknowledged from the server.
This has the effect that sometimes more data has been sent off but isn't acked yet when this function returns, and when this function is
subsequently called again to write more data, libssh2 will immediately figure out that the data is already received remotely.
In most normal situation this should not cause any problems, but it should be noted that if you've once called libssh2_sftp_write() with
data and it returns short, you MUST still assume that the rest of the data might've been cached so you need to make sure you don't alter
that data and think that the version you have in your next function invoke will be detected or used.
The reason for this funny behavior is that SFTP can only send 32K data in each packet and it gets all packets acked individually. This
means we cannot use a simple serial approach if we want to reach high performance even on high latency connections. And we want that.
RETURN VALUE
Actual number of bytes written or negative on failure.
If used in non-blocking mode, it returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative num-
ber, it isn't really a failure per se.
If this function returns 0 (zero) it should not be considered an error, but simply that there was no error but yet no payload data got sent
to the other end.
ERRORS
LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
LIBSSH2_ERROR_SOCKET_TIMEOUT -
LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was received on the socket, or an SFTP operation caused an errorcode to be
returned by the server.
SEE ALSO libssh2_sftp_open_ex(3)libssh2 0.15 1 Jun 2007 libssh2_sftp_write(3)