Take the 2-minute tour ×

i write bash file contain sftp command ... but i have problem every time i execute bash sftp requests password of the remote server .. how i can give sftp password as default parameter ???

share|improve this question

3 Answers 3

SFTP uses SSH protocol. So, you can generate certificates using ssh-keygen and copy it to the remote server using ssh-copy-id. This way you can login without a password.

for more details, have a look at this page.

share|improve this answer

Khaled's answer is probably your best option. You can also use expect for this, good for instances where you are not allowed to install keys for one reason or another.

share|improve this answer
up vote 0 down vote accepted

after i search a bout answer i found we can Automating SFTP using expect ... see the following link Automating SFTP using expect

share|improve this answer
So...like I suggested two hours before you awarded yourself the answer? Nice... –  CarpeNoctem Dec 11 '10 at 6:46

Your Answer


