3 # checking debian-tor account
5 uid
=`getent passwd debian-tor | cut -d ":" -f 3`
6 home
=`getent passwd debian-tor | cut -d ":" -f 6`
8 # if there is the uid the account is there and we can do
9 # the sanit(ar)y checks otherwise we can safely create it.
12 if [ "$home" = "/var/lib/tor" ]; then
14 #echo "debian-tor homedir check: ok"
16 echo "ERROR: debian-tor account has an unexpected home directory!"
17 echo "It should be '/var/lib/tor', but it is '$home'."
18 echo "Removing the debian-tor user might fix this, but the question"
19 echo "remains how you got into this mess to begin with."
34 for i
in lib run log
; do
35 if ! [ -d "/var/$i/tor" ]; then
36 echo "Something or somebody made /var/$i/tor disappear."
37 echo "Creating one for you again."
42 find /var
/lib
/tor \
( \
( ! -user debian-tor \
) -o \
( ! -group debian-tor \
) \
) -print0 |
xargs -0 --no-run-if-empty chown debian-tor
:debian-tor
43 find /var
/lib
/tor
-type d
-print0 |
xargs -0 --no-run-if-empty chmod 02700
44 find /var
/lib
/tor
-type f
-print0 |
xargs -0 --no-run-if-empty chmod 00600
46 find /var
/run
/tor \
( \
( ! -user debian-tor \
) -o \
( ! -group debian-tor \
) \
) -print0 |
xargs -0 --no-run-if-empty chown debian-tor
:debian-tor
47 find /var
/run
/tor
-type d
-print0 |
xargs -0 --no-run-if-empty chmod 02750
48 find /var
/run
/tor
-type f
-print0 |
xargs -0 --no-run-if-empty chmod 00600
50 find /var
/log
/tor \
( \
( ! -user debian-tor \
) -o \
( ! -group adm \
) \
) -print0 |
xargs -0 --no-run-if-empty chown debian-tor
:adm
51 find /var
/log
/tor
-type d
-print0 |
xargs -0 --no-run-if-empty chmod 02750
52 find /var
/log
/tor
-type f
-print0 |
xargs -0 --no-run-if-empty chmod 00640