Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like create a script in HP-UX to send in sftp with password. I have this command

sftp -o PasswordAuthentication=

but if I answer yes or no after, I have this issue "Host key verification failed"

share|improve this question
    
however you don't have paassword, but i think password is mandatory in this option. –  Mohsen Pahlevanzadeh Oct 3 '13 at 12:45
    
try adding -o StrictHostKeyChecking=no if security implications are acceptable... –  jon Oct 3 '13 at 12:49
    
I'm probably misunderstanding the question, but PasswordAuthentication has a mandatory argument, you should probably use sftp -o PasswordAuthentication=yes ... . –  peterph Oct 3 '13 at 14:33

2 Answers 2

If you have socat handy, there's this example in the manual that you could use.

   (sleep 5; echo PASSWORD; sleep 5; echo ls; sleep 1) |
   socat - EXEC:'ssh -l user server',pty,setsid,ctty

          EXEC’utes an ssh session to server. Uses a pty for communication
          between socat and ssh, makes it ssh’s controlling tty
          (ctty), and makes this pty the owner of a new process group 
          (setsid), so ssh accepts the password from socat.
share|improve this answer

I think it would be better if you use passwordless authentication if you're using SFTP on a script. It is possible, I use it when SFTPing between IBM AIX boxes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.