Create a secondary ssh key without a password to configure the ssh tunnel

I need to create a script that automatically configures the ssh tunnel. I think a dedicated ssh key without a password is a good start, but I could not find out if this is possible and how to do it. This key should have limited privileges (only configure the tunnel), but I need another private key (with password) for myself.

Thanks!

+5
source share
3 answers

Ok, I found the answer.

Firstly, ssh-keygen -f theNewPrivateKeyotherwise it will overwrite the old private key. Secondly, the ssh -i theNewPrivateKey me@mycomputerparameter -ichanges the private key used for authentication.

Now I can try my script.


: :

$HOME/.ssh/authorized_keys2 :

command="sleep 99999999999" ssh-dss AAAAB3NzaC1kc3MA...
(+ the rest of the key)

. ssh, . :

ssh -T -R 7878:localhost:22 -i .ssh/mynewkey  me@myhomecomputer

, :

ssh myworklogin@localhost -p7878

, . , !

+8

ssh-keygen

.

+1

, , robocopy script.

.

0

All Articles