Pantheon Community

Use sftp in scripting

Hi all!

I’m creating a script to export webform submissions and download them.

The part of doing the export via terminus is working as expected:

ONLINEPATH="/tmp/export.csv"
terminus drush site.env wfx webformid -- delimeter="," --destination=$ONLINEPATH

But now I want to download it via sftp

LOCALPATH="/mnt/d/tmp/export.csv"
sftp live.guid@appserver.guid.drush.in:2222:$ONLINEPATH $LOCALPATH

When I executing the first time I get this message:

ED25519 key fingerprint is SHA256:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘’ to the list of known hosts.
Persmission denied

The second time I’m getting this message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Any help on this would be much appreciated.

Thx and kind regards.

Howdy!

I’ve seen that message myself at least once and often happens when the IP of the appserver might have changed. You could try deleting the known_hosts file or even just renaming. From the command line you could do something like: mv ~/.ssh/know_hosts ~/.ssh/known_hosts_old to rename it. You could look for the specific appserver as well and remove just the one entry then try again.

Let us know if that helps

1 Like

Hi Jose,

Thx for your reply. I already tried to remove the entry from the known_hosts file, since that suggestions comes below the error message.

 remove with:
  ssh-keygen -f "/home/frederik/.ssh/known_hosts" -R "appserver.live.guid"

However, the next time I try to execute this command, I get the following message:

The authenticity of host 'appserver.live.guid.drush.in (34.141.247.65)' can't be established.
ED25519 key fingerprint is SHA256:key.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'appserver.live.guid.drush.in,34.141.247.65' (ED25519) to the list of known hosts.
live.guid@appserver.live.guid.drush.in: Permission denied (publickey).
Connection closed

Could it be that my syntax is incorrect? I’m not sure how to use the portnumber in this sftp command.

Thanks,
Frederik