I have automated an ftp process that FTP's files from one UNIX box to another in the following format:
ftp -n -v $REMOTE_SERV << EOF
user $FTP_USER $FTP_PASS
cd $REMOTE_PATH
put $CUR_NAME $NEW_NAME
bye
But how can I accomplish this SFTPing from a UNIX box to a LINUX box?
I've seen... (4 Replies)
I need to write a batch script for file transfer from SFTP to Windows system. SFTP is on Linux system. I kept this code in batch file and executing it.. but not working.. Even i tried from Command prompt like this "open sftp.host.com" but getting error. Can anyone help with the code and tell me how... (15 Replies)
Hi,
we have a big problem,
history:
we migrated our companies ftp and sftp-server, which were vsftp and openssh, to one server, software is called JSCAPE ftp server professional edition
for the first time everything was great, but after one or two months, our uploads hang, 0 byte files are... (11 Replies)
Hi all,
Can anyone help ...on how to ensure that a file is locked .
thanks & regards,
Soodoo
----------------------------------------
Problem description: -
We usually use the mv command in scripts to make sure that a file is complete and not being written to by another process.
... (1 Reply)
Hi
the below two line in my sh work fine in Linux but when I run it in HP UX it throws error saying "No such file or directory (-)."
can anyone pleas let me know what is wrong. Any help is appreciated.
INPUTFILE="$(echo ls -1t | sftp -b- $SFTPSERVER:$SFTPDIR |grep ^LK| head -1)"
echo... (1 Reply)
Hi,
I am looking for a shell script to sftp to a file server and copy all the files from a directory after the script is run.
The server name should be a user input parameter and of-course the username/password as well. Rest all should be handled by the script.
I tried with below snippet:-
... (1 Reply)
Hi . We have customer users uploading sales data in excel format in a portal, once this file is uploaded a batch process will SFTP the file from here to a linux virtual machine and then to the mainframe . We are seeing that there are many cases where all the rows the user entered in excel file... (1 Reply)
Hi Everyone,
I am trying to send files from Linux to DataPower server using public key based authentication but it's not working as expected and every-time password expecting for sftp transfer.
Can someone please help on this?
Steps I fallowed:
Created keys pair at source server... (4 Replies)
I want to get a Linux Certification to start my Career in IT sector. My Qualification is MCS from a top university. Suggest me some Linux Certifications. (1 Reply)
Discussion started by: alexwatson1711
1 Replies
LEARN ABOUT CENTOS
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)