Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know, this is not the recommended way to do this. But, I do not have another choice:

I've got to set up a cron job that will regularly upload a file to an external SFTP Server (no FTP available, and I do only have a username/password for it but no key.)

Still, I need to set up a cron that will regularly connect to that sftp and upload a file.

sftp <<EOF
put filename

therefore will not work, because sftp asks for the password, before STDIN is evaluated.

What can I do, to pass the Password to sftp?

Again: I am aware of the potential security risk, but I really do not have any choice here, and the server from which the file is uploaded is protected rather well.

share|improve this question
up vote 2 down vote accepted

Point the SSH_ASKPASS environment variable to a custom program that prints out the password on stdout.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .