Part 9.1: A little info on using screen...

In the next step we'll be using "Screen" to manage tor. This will allow it to keep running independent of your local computer/connection etc.

We'll be using the following command to start tor using screen:

screen tor

So... what is screen? Its a tool you can use to run programs on your linux install that aren't dependent on your current session. If you lose your connection through PuTTY or accidentally disconnect, the process being managed by screen will continue running and allow you to reconnect to it later.

To keep this simple, here is what you really need to know:

if you want to go back to the command prompt after running something with screen, press and hold CTRL and press 'a' ... then release and hit the 'd' key. This will 'detach' from the screen and you will be back at your normal prompt. Screen will keep it running in the background. You can close PuTTY or shut down your local machine. The process will continue running on the server until something stops it.

Now you want to reconnect to the process you ran with screen. We can pull up a list of all screens like so:

screen -ls

This will give you a list of all screen processes which will look something like:

There is a screen on:
        5934.pts-1.zombizu     (12/16/2013 09:44:28 PM)        (Detached)
1 Socket in /var/run/screen/S-root.

The part we're interested in is the screen id. In this case: 5934.pts-1.zombizu

we can reattach to any screen using the following command:

screen -r 5934.pts-1.zombizu

with that, (obviously using your own id) you should now be reconnected as if you had just run the command yourself.

Ok... moving on...

Step 9.2: Run and test your new hidden service...

If you didn't run tor in the last little sub-section, do it now:

screen tor

You should see some output... ultimately ending in something like [notice] Bootstrapped 100%: Done.

Once thats done tor is running. Press CTRL+a and then d to disconnect from the process while leaving tor running in the background.

Now, since we didn't supply a custom hostname yet, tor would have created one for us. The fastest way to find out your new hidden service address is to enter the following command:

nano /tor/hidden_service/hostname

The hostname file and a private_key file were generated by tor. You should see something like khushmmba2aggrgn.onion as the contents of hostname. hit CTRL+x to exit nano. We're gonna back up these files to your local machine using FileZilla.

If you are connected already, just navigate the "Remote Site" to /tor/hidden_service otherwise, run FileZilla and reconnect to your server.

Navigate the left column (your local machine) to a place you can backup these files. For the moment maybe just something like C:\tor_backup you can rt-click and "Create directory" if you need to. Then all you have to do is drag the files from the server to your new backup location. Once downloaded you have everything you need so you can rebuild or recreate this address later. It should look something like this:

Now... fire up the tor browser bundle and we can see if your site is working! I assume if you've already gone this far that you already know how to use tor for browsing the web. If not there are plenty of good tutorials out there on that topic already so just Google it and see what you can learn.

Once your TorBrowser is up and running... post the .onion address form your hostname file into the address bar and connect. If everything is working right... you should see something like the following page:

It will sometimes take a minute or two to connect everything on the first go-round. Give it a minute and refresh once or twice if the connection times out.

Once you've got it working we'll do a quick php test.

For the sake of simplicity and speed... as well as a quick intro into using a command line editor we'll use nano to create a phpInfo page.

Our web root is currently set to /var/www so enter the following command through PuTTY:

nano /var/www/info.php
You should have a new blank file opened.

Enter the following just as you would with a regular text editor:




To save and exit: CTRL+x then 'y' to confirm save... then enter to confirm file name.

now back in your browser go to http://youronionaddress.onion/info.php

Congratulations! You now have everything set up and running properly! This is good for a test/practice server. Please read my disclaimer and make sure you understand that this is not a "properly secured" install. If you life or liberty would be dependent on the anonymity of this website... there is a LOT more work you will need to do to assure your safety.