![]() Here is my scp function based on pexpect. Use paramiko, the python ssh implementation, to do this ssh task instead of invoking an outside program.Use pexpect, the python expect module, to invoke scp and feed the password to it.In this particular case, given that you're already invoking scp from a python script, it seems that one of these would be the most reasonable approach: One of them might suit your needs better than the OpenSSH client. There are other ssh clients available, both free and commercial. Download the ssh source code and build a modified version of ssh that works the way you want.There are ssh client libraries available for most modern programming languages, and you'd have full control over how the client gets the password. Write your own ssh client using perl, python, java, or your favorite language.Note that host-based authentication is only suitable for certain network environments. Get the SSH server administrator to enable host-based authentication and use that.Use (abuse) the SSH_ASKPASS feature to get ssh to get the password by invoking another command, described here or here, or in some of the answers here.Use sshpass, expect, or a similar tool to automate responding to the password prompt. ![]() Use an SSH key for authentication, instead of a password.Any solution for invoking ssh is going to follow one of these approaches: I believe this is a deliberate decision on the part of the OpenSSH developers, because they feel that people should be using more secure mechanisms like key-based authentication. The ssh utility doesn't accept a password on the command line or on its standard input. The OpenSSH scp utility invokes the ssh program to make the SSH connection to the remote host, and the ssh process handles authentication.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |