Last active
May 30, 2019 09:45
-
-
Save assafmo/a2fffe494979787e6525db67f9c938f4 to your computer and use it in GitHub Desktop.
SSH Over TOR (Good for any service, also to expose a server behind NAT)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt install -y tor | |
# get hostname from /var/lib/tor/ssh/hostname on the server | |
torsocks ssh user@xxxxyyyyzzzzaaaa.onion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt install -y tor | |
sudo mkdir -p /var/lib/tor/ssh/ | |
sudo chown -R debian-tor:debian-tor /var/lib/tor/ssh/ | |
sudo chmod 700 /var/lib/tor/ssh/ | |
echo "HiddenServiceDir /var/lib/tor/ssh/" | sudo tee -a /etc/tor/torrc | |
echo "HiddenServicePort 22 127.0.0.1:22" | sudo tee -a /etc/tor/torrc | |
sudo systemctl restart tor | |
# sudo cat /var/lib/tor/ssh/hostname -> xxxxyyyyzzzzaaaa.onion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can also use
HiddenServiceAuthorizeClient
on the server andHidServAuth
on the client (in/etc/tor/torrc
) to be more selective about allowed users.