Using SCP or SFTP with my ssh config file?

  1. From the help text: "... [-F ssh_config] ..."

    According to the above, -F expects one argument: path to an OpenSSH configuration file, ~/.ssh/config or similar. But you are giving it a gzipped SQL dump instead.

    Since plain ssh myalias is already working, you don't even need the -F option here. Just sftp myalias would connect to the server.

  2. However, the OpenSSH sftp client does not support uploading files like you are trying to; it can only download files (using the syntax host:path) or work in interactive mode. For uploading, you need to use either the interactive mode...

    $ sftp myalias
    sftp> cd /tmp
    sftp> put db.sql.gz
    

    ...or the scp tool:

    scp db.sql.gz myalias:/tmp
    

    or

    scp db.sql.gz [email protected]:/tmp
    

(sftp does have a batch mode in which it can read commands from a file, using -b, but it is simpler to use scp for single uploads.)

There are other SFTP clients as well – lftp is good for interactive use, while curl can be easier to automate. For backups and such, you could also use rsync (which runs its own protocol but still inside SSH).