Skip to main content

Command Palette

Search for a command to run...

Unleashing the Power of Curl: Simplifying SFTP File Transfers

Updated
1 min read
Unleashing the Power of Curl: Simplifying SFTP File Transfers
M

DevOps Engineer | Kubernetes | Python | Terraform | AWS | GCP

You may have used tools like scp, rsync, sftp, and lftp to transfer files over SFTP. However, you can also accomplish this with curl. Using curl has its advantages, as you won't need to implement expect-scripts to handle password prompts or manual FTP get/put commands.

Here's an example snippet that downloads a file from a secure SFTP server using custom authentication.

SFTP_HOST=sftp://172.18.1.100
SFTP_AUTH=user:12345678
SFTP_FILE=/data/files/$(date --date="1 day ago" +%Y%m%d)

curl -v -u $SFTP_AUTH $SFTP_HOST/$SFTP_FILE -o $SFTP_FILE 2>&1

More from this blog

M

Minhaz's Blog

111 posts