We have 5 servers running our code: A, B , C, D and E.
From local machine, we sftp the file to A.
Then ssh id@A
su - applicationname
sftp id@A
get
bye
tar -xzf
logout
logout
The same procedure we apply for others B to E.
Is there any way we can simplify this using script ?
We have requested linux team to provide passwordless authentication.
I have read through several threads (which have been helpful) and I'm still getting an error when trying to sftp a file (client wants it to be sftp'ed)
Here is the script:
#!/bin/bash
HOST=XX.XX.XX.XX
PORT=XXXX
USER=root
FILE=/tmp/RANDY
/usr/bin/expect<<EOD
spawn sftp -o Port=$PORT $USER@$HOST
expect "sftp>"
spawn put $FILE
interact
EOD
The error I am receiving is:
spawn sftp -oP
Hi All,
I am using SFTP command to transfer the file.
Code:
SRC=`pwd`
DIG=123
/bin/sftp -B /dev/stdin xyz@abc.net <<::
mput ${SRC}/GGG.${DIG}.tar.gz
bye
::
The problem is, after entring into sftp command, it is not taking variable values of SRC and DIG.
can someone help me what is the other way.
Hi Guys,
I am able to create a file with all the sftp command required.
I was able to ftp the files in the similiar fashion using ftp command. The following i used for ftp.
Code:
ftp -n < $filename
But when i try the same for Sftp.
Dear community,
I have to copy a file from Red Hat to another server that supports only SSH2.
SFTP command from Red Hat works fine, but since I have to insert SFTP command into a script, is it possibile to PUT file using SFTP in "one" line code?
Or, anyway, without using external file?
This works, but instead to put, it GET the file FROM the server:
Code:
sftp user@10.99.1.12:/
I have a script a.sh, which has an sftp command:
echo "Starting to sftp..."
sftp xxx@xxx.xxx.xxx.xx << END_SCRIPT
ls
mput *.csv.gz
bye
END_SCRIPT
echo "Sftp successfully."
If I run it interactively, the log output from sftp is shown. However, if I set it in a crontab and redirect the stdout to a file using >, there will be only the output from the two echo statements.
Hi Experts,
I am writing one shell script. Below is the requirement
1. need to login to the SFTP server, go to the particular folder
2. take the file count in that folder and assign it to variable
3. came out of the SFTP server and check the condition, if the file count is less than the required count exit the script other wise further processing
4.
I was hoping to get a little insight into an expect script that I've written.
Basically we have this expect script to perform an sftp upload, key authentication is not an option, and sftp is the only method supported by our vendor, thus the need for this.
I want to be able to catch timeouts and log an error code for scripting purposes.
I need to:
Log into sftp site
Begin Transfer
Detect that
I have read documentation on SCP and just trying to figure out how go about doing this - below are two pieces of code, one is SFTP and one is SCP. My goal is to have this done via password-less authentication, fully automated.