Tell me how you can transfer the password to create an ssh tunnel from under Windows automatically so that it does not ask. I read the man there only about Linux PS I use cygwin, using putty is not desirable

To connect using the following command:

ssh -R 22:localhost:5551 -o StrictHostKeyChecking=no login@IP "ls -la" 
  • Nikola, judging by the last five of your questions, it makes sense to briefly talk about the task as a whole. Usually we recommend to narrow down the question as much as possible, however (personally to me) it seems that in this case it would be appropriate to clarify the general task. Perhaps this way you will quickly come to the main direction, where to lead the decision. Sign at the end of the assignment. You want to create ssh tunnels automatically, this is understandable. But why? - AK
  • And why do they create tunnels for traffic encryption - Nikola Krivosheya
  • Tunnels for traffic encryption are created by hands, one-time. But why create tunnels massively, in an automated way - a mystery to me. I suspect that this is necessary for spammers, botnets, and there is no good practice at all. Now tell me, why are you creating traffic encryption tunnels? ) - AK

1 answer 1

It is customary not to transfer passwords automatically. SSH uses SSH keys for this. Generate a pair of keys, the public key is configured on the remote hosting, you keep the private key, and connect via ssh without asking for a password.

ssh-keygen - generate a key pair ssh-copy-id user @ host - copy the public key to the remote server (you will need to enter a password) after that all ssh commands will work without asking for a password.