I just had a falling out with a programmer who originally installed my Hidden Service (xxxxxxxxxxxxxxxx.onion) hostname onto a Debian linux cloudhost.

I know it is basically changing my entire Domain so I'll have to tell users where to find me again, but I'd really like to change the hostname / privatekey out for a new one on my Wheezy server without jeapordizing any web files.

Do I have to log in as root? I can't seem to get into my hidden_services folder using the secure sudo user.

  • I'm not quite sure what you are trying on which machine. Could you describe which steps you did on which server (first or second one)? What command did you use in connection with sudo? what was the error message?
    – Jens Kubieziel
    Commented Jun 23, 2014 at 19:55

3 Answers 3


You are correct in the way you are doing it, what you can do is to remove the key\hostname file located where the hidden service stored it.

First make sure you are in the right folder by checking the torrc file,

nano /etc/tor/torrc

scroll down to where it says hidden services, check what folder your hidden service points to. When that's done you can get to that folder as 'root' and move the files out of there and (for example make a backup directory, then move the files)

mkdir /home/yourusername/backupTorHost

mv filename /home/yourusername/backupTorHost/

restart tor:

/etc/init.d/tor restart

And it will then create a new onion url and keyfile for your service, it will not touch your webfiles at all.

But please keep in mind that if your service is dependent on your URL then it can stop function (hardcoded urls, and urls that points to your old domain). That's why it's good to take a backup of the current domain \ keyfile so that you can revert if it goes wrong.

  • This was a great help but apparently it's incomplete. I found out the hard way that you also have to add your new URL to the nginx config file: /etc/nginx/sites-available/default -But even after stopping the nginx service & editing it as root I can't save this change! Man linux is crazy sometimes...
    – user52847
    Commented Jun 25, 2014 at 0:36
  • 1
    It may also be worth noting that configuration changes in any web server you use (e.g. Apache, lighttpd, etc.) are likely to be needed. Commented Jun 25, 2014 at 5:18

you should create new onion domain with its private key.

Making Onion Domain

you will have to use software Shallot. If you have Linux at your home PC/Laptop, just install shallot (./configure && make) and use it (./shallot ^test).

If you use Windows, you will have to use virtualbox + linux iso file, and then install shallot. I chose bodhi linux iso file but it was the same case like debian and ubuntu, I had to install dependencies.

Shallot is located at: https://github.com/katmagic/Shallot

For installation on server, use wget command for downloading/grabbing files to the server:

wget https://github.com/katmagic/Shallot/archive/master.zip
unzip master.zip

(in my case I had to: sudo apt-get install zip unzip). Then you will get folder named Shallot-master, walk into that folder:

cd Shallot-master

Then configure and use it:


After that, you can use it, command is: ./shallot ^test But usually most of people will get "dependencies error", it means you must install g++ or c++, whatever else (you can try: sudo apt-get install build-essential). Therefore I rather chose to install Shallot at my home PC.

Beside it, I succeeded to make onion domain with 7 letters (as I wanted) in 2 hours. But general rule is: There are 14 signs in onion domain and shallot will make for you 3 signs as you want in 1 second, 4 in 2 seconds, 5 in 1 minute, 6 in 30 minutes, 7 in 1 day, 8 signs in 25 days, and so on.

When you get onion domain as you wanted, copy private key in file called hostname which is located at /var/lib/tor/hidden_service/ it should be like this:


content of file should look like this: testvztz3tfoiofv.onion

second file should be:


it should look like this:


P.S. Scallion could also be used for the generation of hidden service hostname/key.
It is much faster than Shallot, but requires a GPU - https://github.com/lachesis/scallion


after make I get this:

cc  -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib  -Wall -o src/math.o -c src/math.c
src/math.c: In function ‘easygen’:
src/math.c:30:5: warning: ‘RSA_generate_key’ is deprecated [-Wdeprecated-declarations]
     rsa = RSA_generate_key(num, 3, NULL, NULL);
In file included from /usr/include/openssl/e_os2.h:13:0,
                 from /usr/include/openssl/bn.h:14,
                 from src/math.h:23,
                 from src/math.c:3:
/usr/include/openssl/rsa.h:234:1: note: declared here
 DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
src/math.c: In function ‘sane_key’:
src/math.c:67:17: error: dereferencing pointer to incomplete type ‘RSA {aka struct rsa_st}’
   BN_sub(p1, rsa->p, BN_value_one()); // p - 1
src/math.c:78:10: error: dereferencing pointer to incomplete type ‘BIGNUM {aka struct bignum_st}’
Makefile:44: recipe for target 'src/math.o' failed
make: *** [src/math.o] Error 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .