OP posted:
I tried to manually start Tor (by typing /usr/sbin/tor
in the terminal) and afterwards Vidalia and it works perfectly.
From the documentation of Vidalia:
I Can't Start Tor
The most likely reason that Vidalia could not start Tor is because
Vidalia is looking for your Tor installation in the wrong directory.
You can tell Vidalia where Tor is located by updating the Tor
Executable option in the general configuration settings. Another
possible reason that Tor cannot start is because there is already
another Tor process running. Check your list of running process and
stop the previous Tor process, if you find one. Then, try running Tor
again.
If that did not help, check your message log to see if Tor printed any
information about errors it encountered while trying to start.
Vidalia Can't Connect to Tor
Vidalia manages Tor by communicating with it via Tor's control port.
The most common reason that Vidalia cannot connect to Tor is because
Tor started, but encountered an error and exited immediately. You
should check your message log to see if Tor reported any errors while
it started.
If Tor is listening on a different port than Vidalia expects, Vidalia
will be unable to connect to Tor. You rarely need to change this
setting, but if there is another service running on your machine that
conflicts with Tor's control port, you will need to specify a
different port. You can change this setting in Vidalia's advanced
configuration settings.
Tor Exited Unexpectedly
If Tor exits immediately after trying to start, you most likely have
another Tor process already running. Check the message log to see if
any of the last few messages in the list are highlighted in yellow and
contain a message similar to the following:
connection_create_listener(): Could not bind to 127.0.0.1:9050: Address already in use.
Is Tor already running?
If you find an error message like the one above, you will need to stop
the other Tor process before starting a new one with Vidalia. On
Windows, you would need to look for tor.exe in your Task Manager. On
most other operating systems, the ps command can help you find the
other Tor process.
If Tor had been running successfully for awhile (that is, longer than
a few seconds), then you should check the message log for information
about any errors Tor experienced before it exited. Such errors will be
highlighted in either red or yellow.
Digging around, I've found one possible solution. This involves setting two hotkeys, and the usage of gsettings.
After configuring your proxy settings, you will need to go to Settings > Devices > Keyboard and create one custom hotkey that initiates the following command:
gsettings set org.gnome.system.proxy mode manual
Then create a second one for:
gsettings set org.gnome.system.proxy mode none
As the proxy settings remain saved whether enabled or not, you can then assign an 'enable' key for the first command, and a 'disable' key for the second.
Confirm the change by pressing your first hotkey and navigating to Settings > Network, then navigating away, pressing your second hotkey, and returning to the network settings. Assuming Tor is set up correctly, and passes https://check.torproject.org, this should be all that's needed.
Perhaps not the most ideal solution, but it will do for now, unless someone comes up with a toggle on the activity bar or something.
EDIT:
A slight improvement on the above, is to use one hotkey that checks the current state of the proxy mode, then sets it to the opposite. Grab your text editor and create a new file with the following contents:
case "$(gsettings get org.gnome.system.proxy mode)" in
"'none'") gsettings set org.gnome.system.proxy mode "'manual'"
notify-send "Tor Enabled";;
"'manual'") gsettings set org.gnome.system.proxy mode "'none'"
notify-send "Tor Disabled" ;;
esac
This will also display a message showing the current state of your proxy settings.
Save the script somewhere, then reference the file location when creating a custom hotkey.
Best Answer
What you need to configure is polipo/privoxy for tor as your are using http proxy. Tor doesnot use 8118 as its port it uses 9050 and it is a socks proxy. You can use this configuration for
polipo
to use withtor
. Just do:sudo wget https://gitweb.torproject.org/torbrowser.git/blob_plain/HEAD:/build-scripts/config/polipo.conf -O /etc/polipo/config
sudo service tor stop && sudo service polipo stop
sudo service tor start && sudo service polipo start
tor needs to start before polipo, or else polipo will occupy the 9050 port and tor will start with errors
I am giving much focus here on
polipo
because tor itself recommendspolipo
and is installed by default ontor
installation. You can useprivoxy
in place ofpolipo
as well. Most of thetor
users recommend using the default socks proxy if the application handles it.Go to the Network settings and select the proxy method to Manual. Set all addresses to 127.0.0.1 and all ports to 8118, except for the socket port which needs to be 9050. With this setup, the following components are not necessary and not encouraged:
Whenever you want to use your direct connection again, refer to the Network settings and change the proxy method to None.