You are not logged in.

#1 2013-06-12 13:31:07

arcon
Member
Registered: 2013-05-27
Posts: 128

Unable to chroot tor

As per https://wiki.archlinux.org/index.php/Tor#Configuration i created a script called tor-setup.sh and run it as a root, but when i am chrooting into

chroot /opt/torchroot /usr/bin/tor

i am getting this error:

chroot: cannot change root directory to /opt/torchroot: Operation not permitted

and when i run it through sudo i got this:

[notice] Tor v0.2.3.25 running on Linux.
 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
 [notice] Read configuration file "/etc/tor/torrc".
 [notice] Initialized libevent version 2.0.21-stable using method epoll (with changelist). Good.
 [notice] Opening Socks listener on 127.0.0.1:9050
 [warn] /var/lib/tor is not owned by this user (<unknown>, 0) but by tor (43). Perhaps you are running Tor as the wrong user?
 [warn] Failed to parse/validate config: Couldn't access/create private data directory "/var/lib/tor"
 [err] Reading config failed--see warnings above.]

i think there is some permission issue, but not sure what it is??
please can anybody tell me about that...
smile

Last edited by arcon (2013-06-12 13:32:07)


The short cuts are only short because they don't actually go anywhere. -- Trilby
Nothing feels better than being understood -- awayand
A pathetic dreamer smile

Offline

#2 2013-06-12 15:44:40

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Unable to chroot tor

Possibly you need to add tor to /etc/shells

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#3 2013-06-12 19:50:19

arcon
Member
Registered: 2013-05-27
Posts: 128

Re: Unable to chroot tor

No luck.. sad


The short cuts are only short because they don't actually go anywhere. -- Trilby
Nothing feels better than being understood -- awayand
A pathetic dreamer smile

Offline

#4 2013-07-16 10:03:59

vyu223
Member
Registered: 2013-02-18
Posts: 24

Re: Unable to chroot tor

It's been over a month; I hope necrobumping is appropriate in this case, since I experienced the same exact "problem" a couple of days ago and have the solution.

The solution is as follows:

# chroot --userspec=tor:tor /opt/torchroot /usr/bin/tor

Or to use systemd, put this into /etc/systemd/system/torchroot.service:

[Unit]
Description=torchroot
After=network.target

[Service]
User=root
Type=simple
ExecStart=/usr/bin/sh -c "chroot --userspec=tor:tor /opt/torchroot /usr/bin/tor -f /etc/tor/torrc"
KillSignal=SIGINT
LimitNOFILE=8192

[Install]
WantedBy=multi-user.target

And then do:

# systemctl enable torchroot.service
# systemctl start torchroot.service

You won't have any luck trying to run the command chroot as your normal user or the user tor. But /usr/bin/tor expects to be run by tor. So you run the chroot command as root, but use the option --userspec=tor:tor to have the specified command (that is, /usr/bin/tor) run as tor instead. Do a 'man chroot'. I hope my explanation didn't suck too much.

Last edited by vyu223 (2013-07-16 10:05:10)

Offline

#5 2013-07-16 11:18:01

arcon
Member
Registered: 2013-05-27
Posts: 128

Re: Unable to chroot tor

Thanks for finding the solution and posting it here.

vyu223 wrote:

I hope my explanation didn't suck too much.

Hahaha no way actually it's pretty good i'm able to understand every thing, thanks aagain.

Last edited by arcon (2013-07-16 11:18:28)


The short cuts are only short because they don't actually go anywhere. -- Trilby
Nothing feels better than being understood -- awayand
A pathetic dreamer smile

Offline

Board footer

Powered by FluxBB