Hi all,
I have the following script, but are not too sure about the syntax to complete the script.
In essence, the script must connect to a SFTP server at a client site with username and password located in a file on my server.
Then change to the appropriate directory.
Pull the data to the local directory on my side.
And remove the data on the client side.
umask a=rwx
ERRLOG=/tmp/client.errlog
LOG=/tmp/client.log
#Login Settings
FTPLOGIN=/home/client/.login.cfg
REMOTEDIR=DATA/MARKET/*.txt
LOCALDIR=/ftp/client/data/
FILE=`ls -1 *.txt 2> /dev/null`
# Connect and collect
/usr/local/bin/ncftpget -P 22 -DD -f $FTPLOGIN $LOCALDIR $REMOTEDIR
The file: /home/client/.login.cfg contains:
The FTP application "/usr/local/bin/ncftpget" supports port 22 but when trying to connect to the client server it cannot connect.
I think the SSH encryption and protocol cannot be read as it is a normal FTP application.
I need to use something like SFTP to do the same as the above script.
Connect
Change directory and pull data
Remove data from client server
Close connection
Thanks