This shows you the differences between two versions of the page.
cs:ssh [2015/10/28 15:22] |
cs:ssh [2020/11/26 23:18] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SSH ====== | ||
+ | ===== SSH login without password ===== | ||
+ | Generate a public and private key for a machine: | ||
+ | <code bash> | ||
+ | ssh-keygen -t rsa | ||
+ | </ | ||
+ | do not put password. Private and public keys are stored in // | ||
+ | Copy public key in the remote machine with the command: | ||
+ | <code bash> | ||
+ | cat ~/ | ||
+ | </ | ||
+ | |||
+ | Now login can be performed directly without password. | ||
+ | |||
+ | Remember that in the remote host correct permissions are '' | ||
+ | |||
+ | ===== Reverse SSH tunneling ===== | ||
+ | There are two PCs, the //client// behind a NAT and the //server// with a public IP address. We want to access the //client// from the //server//. | ||
+ | |||
+ | We can follow the following steps: | ||
+ | * Exchange keys in order to allow the //client// to login into the //server// without typing a password. | ||
+ | * Add in the file /// | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | su -c " | ||
+ | </ | ||
+ | that are runed on startup and allow the access to the //client// with the command: | ||
+ | <code bash> | ||
+ | ssh < | ||
+ | </ | ||
+ | * Give to the file the execution permission: | ||
+ | <code bash> | ||
+ | sudo chmod +x / | ||
+ | </ | ||
+ | |||
+ | The //client// must have the ability to connect with the //server// without password. To this extent follow the guide "SSH login without password" |