1

I need to make a shell script that will transfer files to a remote server however, the account given to me has no shell mainly because they want to restrict the access to sftp only. I already have a shell script my only problem is that I cannot automate it. The script stops on the password prompt. I read on most of the passwordless sftp tutorials that I need to generate a keypair but like i've said I cannot do this as the remote account has no shell access. What are the alternatives for passwordless sftp considering an account without shell? The remote server has no 'expect' installed.

Thank you very much.

EDIT: Please also note that I cannot install anything in the local server. I MAY be able to do something on the remote server but not on the local.

sking100
  • 11
  • 2

1 Answers1

1

On Debian and Ubuntu (maybe other systems also) you can use sshpass

apt-get install sshpass
sshpass -p 'YourPassword' ssh user@host

OR

sshpass -p 'YourPassword' sftp user@host

But the you will have your password printed in your bash_history..
So you might want to pass the password from a file or an environment-variable.

Greets, Eric

Tzah Mama
  • 1,547
  • 1
  • 13
  • 25
emarten
  • 19
  • 1