How to perform checksum of a file on remote server using Curl?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to perform checksum of a file on remote server using Curl?
# 1  
Old 08-29-2017
Question How to perform checksum of a file on remote server using Curl?

Hi, We have an AIX server and have CURL 7.40 installed in it.

We are struggling to perform checksum on the file present on the remote server (AWS). We want to validate the checksum on the file pre and post download to make sure that there is no issue with the file.

We are writing a shell script and we are using Curl for FTPS connection and downloading the file from AWS to AIX.

I have copied the code snippet that we have written to list the files and download them.

Code:
#list files on AWS server
curl -tlsv1.2 --cacert certs.cer --ftp-ssl --ftp-skip-pasv-ip --list-only --cert ${CERT_USER}:${CERT_USER_PWD} ftp://${USER_NAME}:${USER_PWD}@awscloud.com:50021/Inbox/* > ${LOGS}

#download the files mentioned in the list file
cat ${LOGS} | \
awk '{print $1}' | \
while read FILENAME
do
 echo "File being copied currently is ${FILENAME} "
 curl -tlsv1.2 --cacert certs.cer --ftp-ssl --ftp-skip-pasv-ip --cert ${CERT_USER}:${CERT_USER_PWD} ftp://${USER_NAME}:${USER_PWD}@awscloud.com:50021/Inbox/${FILENAME} -o ${FILENAME}
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

3. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

4. Shell Programming and Scripting

How to create a file in remote server from local server?

hi, can anyone tell me how can i store the names of a file that are in remote server to a file and then get the file that contains the name in local server? there is a remote server where 5 files are present , say a.txt b.txt c.txt d.txt e.txt i want to write a script in my local... (4 Replies)
Discussion started by: Little
4 Replies

5. Shell Programming and Scripting

Curl ftp upload success but no file exist on the server !!!!

hello, I'm trying to upload a file to this ftp server and others ftp://ftp.byethost12.com as you can see in the output of CURL using the -v option curl reports that the upload succeeded but when i connected to the server with file-zilla there is no file uploaded the same command upload files... (5 Replies)
Discussion started by: laraaj
5 Replies

6. Shell Programming and Scripting

checksum of remote server

Hi I am trying to check the successfull transfer of a file from my local server to remote server. I wish to generate a md5 checksum of the file residing on my local server and also generate a md5checksum on the remote server and compare value. I was successfull in generating checksum on local... (2 Replies)
Discussion started by: vasuarjula
2 Replies

7. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

8. Shell Programming and Scripting

Use cURL in shell script and get most recent file from remote server using SFTP

I have been trying to implement the following shell script -- sftp to remote server get list of files in the directory sftp get the most recent listed file exit This script will be scheduled to be executed everyday using CRON or CONTROL-M and the need is to have absolutely no human... (7 Replies)
Discussion started by: toobrown1
7 Replies

9. Shell Programming and Scripting

Transfer file from local unix server to remote server

want to remove this thread. thanks (2 Replies)
Discussion started by: indira
2 Replies

10. HP-UX

Transfer file from local unix server to remote server

want to remove the thread thanks (2 Replies)
Discussion started by: indira
2 Replies
Login or Register to Ask a Question
CURLOPT_SSL_VERIFYHOST(3)				     curl_easy_setopt options					 CURLOPT_SSL_VERIFYHOST(3)

NAME
CURLOPT_SSL_VERIFYHOST - verify the certificate's name against host SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYHOST, long verify); DESCRIPTION
Pass a long as parameter specifying what to verify. This option determines whether libcurl verifies that the server cert is for the server it is known as. When negotiating TLS and SSL connections, the server sends a certificate indicating its identity. When CURLOPT_SSL_VERIFYHOST(3) is 2, that certificate must indicate that the server is the server to which you meant to connect, or the connection fails. Simply put, it means it has to have the same name in the certificate as is in the URL you operate against. Curl considers the server the intended one when the Common Name field or a Subject Alternate Name field in the certificate matches the host name in the URL to which you told Curl to connect. When the verify value is 1, curl_easy_setopt will return an error and the option value will not be changed. It was previously (in 7.28.0 and earlier) a debug option of some sorts, but it is no longer supported due to frequently leading to programmer mistakes. Future versions will stop returning an error for 1 and just treat 1 and 2 the same. When the verify value is 0, the connection succeeds regardless of the names in the certificate. Use that ability with caution! The default value for this option is 2. This option controls checking the server's certificate's claimed identity. The server could be lying. To control lying, see CUR- LOPT_SSL_VERIFYPEER(3). LIMITATIONS
DarwinSSL: If verify value is 0, then SNI is also disabled. SNI is a TLS extension that sends the hostname to the server. The server may use that information to do such things as sending back a specific certificate for the hostname, or forwarding the request to a specific origin server. Some hostnames may be inaccessible if SNI is not sent. NSS: If CURLOPT_SSL_VERIFYPEER(3) is zero, CURLOPT_SSL_VERIFYHOST(3) is also set to zero and cannot be overridden. DEFAULT
2 PROTOCOLS
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); /* Set the default value: strict name check please */ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L); curl_easy_perform(curl); } AVAILABILITY
If built TLS enabled. RETURN VALUE
Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not. If 1 is set as argument, CURLE_BAD_FUNCTION_ARGUMENT is returned. SEE ALSO
CURLOPT_SSL_VERIFYPEER(3), CURLOPT_CAINFO(3), libcurl 7.54.0 February 02, 2017 CURLOPT_SSL_VERIFYHOST(3)