0

Is it possible to pass SFTP USER/PASS to a server in an automated script that will log in and retrieve a file?

I know that KEY PAIRS are the recommended method but assume thats not possible in this case.

steelthunder
  • 438
  • 2
  • 12
  • 27

1 Answers1

0

In the simplest case you use a key based authorization so you don't need to enter any credentials.

For doing that create a key:

ssh-keygen -t rsa

And copy it to the target system:

ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote-system

Now you can login to the system without a password.

If your problem is the missing ssh-copy-id command try this here:

cat ~/.ssh/*.pub | ssh user@remote-system 'umask 077; cat >>.ssh/authorized_keys'
rekire
  • 47,260
  • 30
  • 167
  • 264
  • thank you but I stated in my question key pairs is not an option at this time. Assume the server admin has a policy not to use key pairs. – steelthunder Aug 04 '14 at 20:28