SSH into your VPS over Tor

Remote Connection
User avatar
ethical hacker
Posts: 65
Joined: Thu Feb 29, 2024 10:48 pm

SSH into your VPS over Tor

Postby ethical hacker » Fri Mar 01, 2024 2:55 am

Occasionally, employing one's own VPS with suitable specifications for initiating an assault proves more advantageous than procuring a compromised server. Compromised servers can present a myriad of issues, as they may have already been infiltrated by other hackers, under surveillance by third parties, functioning as honeypots, or their security may have identified a breach and revoked your access. Such circumstances are unfavourable.

What's the best VPS provider?
No VPS provider is endorsed; however, whichever VPS provider you opt for, ensure it adheres to the following criteria:
- Capability to make payments using BTC.
- Accessibility to the provider's website via Tor.
- Ability to log in through Tor.
- Provision of relatively efficient customer service for rebooting your VPS in case of issues (which are inevitable).

SSH INTO YOUR VPS OVER TOR
When you have received your credentials for your VPS, you will access it through SSH via Tor. It is imperative that you do not access the VPS without utilizing SSH over Tor, as this could potentially expose your IP address to the VPS provider. It is strongly advised against engaging in this action. Always employ SSH over Tor when establishing a connection to the VPS.
If you are utilizing Whonix or Tails, you can effortlessly SSH into your VPS over Tor without any concerns by executing the following command:

Code: Select all

ssh USERNAME@IP


To those individuals desiring to utilize Windows or macOS, it is imperative to initiate the Tor standalone application initially. Subsequently, establish a connection to your Virtual Private Server (VPS) with the appropriate proxy settings enabled, thereby guaranteeing that your connection is channeled through Tor.

To access your VPS via SSH, it is imperative to execute the Tor standalone file initially.
Proceed to the directory where the Tor Browser has been downloaded.

- macOs
Type in terminal:

Code: Select all

cd /Applications/TorBrowser.app/Contents/MacOS/Tor
./tor.real

- Windows
Type in Terminal:

Code: Select all

cd Tor Browser\Browser\TorBrowser\Tor
tor.exe

- Linux
Type in terminal:

Code: Select all

cd tor-browser_en-US/Browser/TorBrowser/Tor
./tor


To commence, the Tor standalone will be initiated, establishing a connection to the Tor network via the standard port 9050. Subsequently, applications can be rerouted to 127.0.0.1:9050 to channel them through Tor.
For individuals utilising Windows, it is imperative to procure and install Putty, subsequently configuring it to utilise a proxy for 127.0.0.1 Port: 9050.

SSH over Tor VPS for macOS and Linux users:
Initiate a fresh terminal window while ensuring the Tor standalone remains operational, then establish a connection to your VPS. Insert the ensuing command into the terminal, ensuring to modify the USERNAME and VPS_IP to correspond with the credentials furnished by the VPS provider.

Code: Select all

ssh -o "ProxyCommand nc -X 5 -x 127.0.0.1:9050 %h %p" USERNAME@VPS_IP


Once logged into your VPS, always remember to ensure it remains updated and to install the necessary upgrades. Typically, executing these commands will safeguard your bash history from unauthorized access.

Code: Select all

cat /dev/null > .bash_history
history -c
export HISTFILESIZE=0
export HISTSIZE=0
unset HISTFILE
echo 'set +o history' >> /etc/profile
echo 'set +o history' >> ~/.bashrc
export HISTFILE=/dev/null

Return to “RDP / VPS / SERVERS”