Difference between revisions of "Linux Remote Shell Notes"
From Free Knowledge Base- The DUCK Project: information for everyone
(Created page with " === auto login ssh === The OpenSSH ssh utility doesn't accept a password on the command line or on its standard input. I believe this is a deliberate decision on the part of...") |
|||
Line 1: | Line 1: | ||
− | + | == auto login ssh == | |
The OpenSSH ssh utility doesn't accept a password on the command line or on its standard input. I believe this is a deliberate decision on the part of the OpenSSH developers. You have these options available to you: | The OpenSSH ssh utility doesn't accept a password on the command line or on its standard input. I believe this is a deliberate decision on the part of the OpenSSH developers. You have these options available to you: | ||
Line 11: | Line 11: | ||
Download the ssh source code and build a modified version of ssh that works the way you want. | Download the ssh source code and build a modified version of ssh that works the way you want. | ||
Use a different ssh client. There are other ssh clients available, both free and commercial. One of them might suit your needs better than the OpenSSH client. | Use a different ssh client. There are other ssh clients available, both free and commercial. One of them might suit your needs better than the OpenSSH client. | ||
+ | |||
+ | === sshpass === | ||
+ | |||
+ | Install the sshpass utility so that you can automate ssh login including password. | ||
+ | apt install sshpass | ||
+ | Now you can automate the login process | ||
+ | sshpass -p "mysecretpass" ssh -o StrictHostKeyChecking=no nicolep@192.168.100.10 | ||
+ | Custom port example: | ||
+ | sshpass -p "mysecretpass" ssh -o StrictHostKeyChecking=no nicolep@192.168.100.10:9600 |
Revision as of 10:45, 5 March 2018
auto login ssh
The OpenSSH ssh utility doesn't accept a password on the command line or on its standard input. I believe this is a deliberate decision on the part of the OpenSSH developers. You have these options available to you:
Use an SSH key for authentication, instead of a password. Use sshpass, expect, or a similar tool to automate responding to the password prompt. (ab)Use the SSH_ASKPASS feature to get ssh to get the password by running another program, described here or here, or in some of the answers here. Get the SSH server administrator to enable host-based authentication and use that. Note that host-based authentication is only suitable for certain network environments. See additional notes here and here. Write your own ssh client using perl, python, java, or your favorite language. There are ssh client libraries available for most modern programming languages, and you'd have full control over how the client gets the password. Download the ssh source code and build a modified version of ssh that works the way you want. Use a different ssh client. There are other ssh clients available, both free and commercial. One of them might suit your needs better than the OpenSSH client.
sshpass
Install the sshpass utility so that you can automate ssh login including password.
apt install sshpass
Now you can automate the login process
sshpass -p "mysecretpass" ssh -o StrictHostKeyChecking=no nicolep@192.168.100.10
Custom port example:
sshpass -p "mysecretpass" ssh -o StrictHostKeyChecking=no nicolep@192.168.100.10:9600