[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-dev] authentication questions on Tor controller



I just start to use tor controller, I notice the mannual says:

 pass Tor the "--CookieAuthentication 1" option when you start it.  Tor will create a file in its data directory
Âcalled "control_auth_cookie". All your controller needs to do is to pass the contents of this file to authenticate()
when it connects to Tor.



Âthere are two kinds of Tor, one is installed and can be run by command "tor"
the other is Tor Browser Bundle,

1) with command "tor", when it establishes, if I run example.py
the result is
ÂÂÂÂÂÂÂÂÂÂ "Connection refused. Is the ControlPort enabled?"

I tried command:Â "tor --CookieAuthentication 1"Â to start Tor,
but I can't find the so called data directory, and the running information saysï
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ Could not open "/etc/tor/torrc": Permission denied

2) with TBB, after I started TBB, if I run example.py,
it seems it can connect to
ControlPort, but it prompts for a password
there is a Data directory in TBB, but I can't find the so called
"control_auth_cookie"
file, so when I run TBB, how can I pass "
--CookieAuthentication 1" to tor?


example.py :

import time
import TorCtl

class BandwidthListener(TorCtl.PostEventListener):
 def __init__(self):
ÂÂÂ TorCtl.PostEventListener.__init__(self)

 def bandwidth_event(self, event):
ÂÂÂ print "tor read %i bytes and wrote %i bytes" % (event.read, event.written)

# constructs a listener that prints BW events
myListener = BandwidthListener()

# initiates a TorCtl connection, returning None if it was unsuccessful
conn = TorCtl.connect()

if conn:
 # tells tor to send us BW events
 conn.set_events(["BW"])

 # attaches the listener so it'll receive BW events
 conn.add_event_listener(myListener)

 # run until we get a keyboard interrupt
 try:
ÂÂÂ while True:
ÂÂÂÂÂ time.sleep(10)
 except KeyboardInterrupt: pass


_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev