Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
selfhost:ssh_tunnel [2024/01/25 13:03] – created willy | selfhost:ssh_tunnel [2024/02/08 17:28] (current) – removed willy | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
- | |||
- | ===== On Local Host ===== | ||
- | |||
- | Create a new user called **tunnel**. | ||
- | Leave tunnel home folder on root partition (/ | ||
- | You need also to create an SSH key, and prepare the tunnels config folder **/ | ||
- | <code bash> | ||
- | > useradd -m tunnel | ||
- | > su - tunnel | ||
- | > ssh-keygen | ||
- | > mkdir tunnels | ||
- | > mkdir logs | ||
- | </ | ||
- | |||
- | Add tunnels configurations like this under **/ | ||
- | <file txt main> | ||
- | REMOTE_SERVER=99.99.99.99 # your remote server IP - don't use name, use IP | ||
- | REMOTE_SERVER_SSH_PORT=22 # your remote server SSH port | ||
- | HOME_SERVER_REMOTE_SSH_PORT=5022 # the port your local server SSH will be accessible from remote | ||
- | SSH_IDENTITY=# | ||
- | REMOTE_USER=tunnel # remote user to login as | ||
- | |||
- | REMOTE_TO_HOME=\ | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | |||
- | HOME_TO_REMOTE= # list of ports forwarded from local to remote | ||
- | </ | ||
- | |||
- | You can create as many tunnels as you like. Note that SSH port will always be forwarded anyway, so you want one file for each remote host. | ||
- | |||
- | Now create this script under **/ | ||
- | <code bash> | ||
- | |||
- | |||
- | </ | ||
- | |||
- | and set it as executable: | ||
- | <code bash> | ||
- | > chmod +x / | ||
- | </ | ||
- | |||
- | Share tunnel' | ||