Reputation: 2328
I'm writing an application (in Node.js) where I'll need to access an SFTP server and allow the user to supply credentials and browse for a file on a server. I've tried using expect to connect via SSH, but I found that much too difficult and too error prone with all the different OSes/distros/SSH server customizations. Is there a command-line tool that I can easily use to establish the connection and get directory listings as the user browses around their server? I have tried using the executables included with FileZilla, but the lack of documentation prevented me from achieving anything.
Upvotes: 1
Views: 1217
Reputation: 29595
OpenSSH (sftp) has taken the approach that you shouldn't do what you want to do (for security reasons), so they made it difficult (they want you to use SSH key authentication instead). The only way i know to get around this using openSSH is expect (i.e. fooling sftp into thinking it's interacting with a human).
The only sftp client i have found that allows easily entering a password programmatically, is the one that is part of the Net::SSH Ruby library.
Upvotes: 1