Scripting FTPES (Explicit TLS/SSL) with cURL

You may also like...

5 Responses

  1. Edward says:

    Thanks for your help. This is exactly what I was trying to attempt by other inefficient means. Do you have twitter? I was going to follow you however I suppose I could subscribe via rss.

  2. Raja says:

    In my unix, I don’t have –ftp-ssl option. so how to specify? is that version issue?

    The current version which I see in my unix envrionment is:

    I need to use curl for FTPES

    Version Info:
    curl 7.10.3 (sparc-sun-solaris2.8) libcurl/7.10.3

    any suggestion?

  3. Lewis says:

    Hi Raja, it would probably mean that the version you have doesn’t support FTPS or FTPES as it wasn’t compiled with that library/option so that option simply doesn’t exist for you. You may need to compile it from source and include the necessary additional libraries and options to get a working binary for use with FTPS/FTPES servers.

  4. Rusty says:

    Hey Lewis,

    Thank you so much for your advise, that has saved me many hours and hair-pulling!

    I had quite a big problem trying to connect to my web hosting provider’s FTP using FTPES for two reasons:
    1. They were using older SSL certificates and I was using a Mac.
    2. I don’t have fixed internet at home (ADSL etc), I use my phone on personal hotspot with Telstra (Australia) as my provider. This is where you saved the day!

    Issue 1 was quite bizarre as I was successfully able to connect using FTPES on a Windows machine but not on a Mac. Turns out Apple are less forgiving when it comes to connecting over SSL where the certificates are not as strong as they could be. I spoke with my provider who give awesome support and they re-issued new and better certificates – great.

    But then I still couldn’t connect at home. I realised I could if I used somebody else’s ADSL connection, but not with my phone connected. So your answers above explained it all. Thanks to Telstra for their over-zealous UTM. *sigh*

    Issue 2 was fixed by my web hosting provider kindly opening another port and mapping it to port 21 on the FTP server – so this bypasses the UTM sniffing on port 21 connections. Problem solved and connection is encrypted.

    Thanks again!

    Rusty

  5. Arnold says:

    Hello
    Please, Can you rectify my script?
    $Xftp = “ftp://perso-ftp.orange.fr/”

    # ?????????????
    $Xftp.UsePassive = $true
    $Xftp.EnableTls = $true

    $XlocalDirectory = “c:\studio\”
    $Xuser = “………….”
    $Xpass = “………….”

    $Xwebclient = New-Object System.Net.WebClient
    $Xwebclient.Credentials = New-Object System.Net.NetworkCredential($Xuser,$Xpass)
    $XFiles = Get-ChildItem -Path “c:\studio\*” -Rec -For | ? {$_.LastWriteTime -gt (Get-Date).AddHours(-1)} | where { ! $_.PSIsContainer } | Select-Object FullName
    $Xnombre = $XFiles.Count
    foreach ($XFile in $XFiles)
    {
    $XLocalFile = $XFile.FullName

    $XRemoveDirectory = $XLocalFile.Replace(“C:\studio\”,””)
    $XChangeSlashes = $XRemoveDirectory.Replace(‘\’, ‘/’)
    $XRemoveSpaces = $XChangeSlashes.Trim()
    $XRemoteFile = $Xftp+$XRemoveSpaces
    $Xuri = New-Object System.Uri(“$XRemoteFile”)
    $Xwebclient.UploadFile($Xuri, $XLocalFile)

    Write-Host “Getting $XFile from $XlocalDirectory” -Foreground “Red” -BackgroundColor DarkBlue
    Write-Host “Puting $XFile to $Xftp” -Foreground “Yellow” -BackgroundColor DarkBlue
    }
    Write-Host “Finished Sync to $Xftp” -Foreground “Green” -BackgroundColor DarkBlue
    “”
    $Xnombre.ToString() + ” File sync — END — ” + (Get-Date)
    $Xtext1 = $Xnombre.tostring() + ” File sync — END — ” + (Get-Date)

    Many thanks for your help
    Arnold

Leave a Reply

Your email address will not be published. Required fields are marked *