20

Seeing that I find the technical side of it extremely interesting, I want to try to set up a Tor hidden service. For this I am following the Torproject instructions. I installed Tor, have it running, installed a LAMP server, and then edited the /etc/tor/torrc file with the following lines:

HiddenServiceDir /home/hubbtwea/hidden_service/
HiddenServicePort 80 127.0.0.1:80

Restarting tor (with sudo /etc/init.d/tor_restart) should then create the folder /home/hubbtwea/hidden_service/ with two files in it. Restarting goes fine:

 * Stopping tor daemon...               [ OK ]
 * Starting tor daemon...               [ OK ]

but afterwards, there is no folder created in my home dir. I then try to restart Tor again (with the same command) and then it says the following:

 * Stopping tor daemon...               [fail]
 * Starting tor daemon...               [ OK ]

It seems to be able to start, but not to stop (I wouldn't know why), and there is still no hidden_service folder created in my home folder.

Does anybody know what I could be doing wrong here?

mikemaccana
  • 103
  • 4
hubbtwea
  • 411
  • 2
  • 5
  • 6

3 Answers3

7

Tor checks the ownership of several files and directories at startup. One of those directories is the HiddenServiceDir. This should belong to the user who started the Tor process. Otherwise you will get the warning:

Oct 06 12:34:56.000 [warn] /foo/bar is not owned by this user (johndoe, 1011) 
    but by root (0). Perhaps you are running Tor as the wrong user?

It seems you are using Debian or some similar distribution. They use the system user debian-tor to run the Tor process. So you should make sure that the hidden service directory is owned by this user.

Apart from that I would not recommend to put the hidden service data inside your home directory. This data is often accidentally deleted, put into some cloud or misused otherwise. So you risk to give those data out of your hand. Debian puts it by default into /var/lib/tor. This is often better than the home directory and also conform to the Filesystem Hierarchy Standard.

Jens Kubieziel
  • 8,630
  • 5
  • 35
  • 116
3

I just solved what I believe may be your problem as well.

Try leaving the 'HiddenServiceDir' alone or back to it's normal value which I believe is

HiddenServiceDir /var/lib/tor/hidden_service/

Restart Yor with these

sudo service tor stop
sudo service tor start

You won't have access to /var/lib/tor so to access the .onion address from /var/lib/tor/hidden_service/ you could use

sudo cat /var/lib/tor/hidden_service/hostname
Roya
  • 3,240
  • 3
  • 19
  • 40
user310848
  • 31
  • 1
-1

Check in the logs (/var/log/tor/log) if your LAMP and/or Tor has access to create a folder for your hidden service. You can create it manually (that is the best in that case) and then chmod it to 777 an chown to debian-tor. That should solve all your problems !

(answer written based on comments)

TN888
  • 283
  • 3
  • 12