summaryrefslogtreecommitdiffstats
path: root/infest/etc_aggressive
blob: c21f5d167e56d7efefcfa26c9b95c3ca17205d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/sh

#prereqs
/krebs/infest/etc_coexistential

f=/etc/passwd
sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $f
sed -ri '/^krebs/d' $f
echo "krebs:x:0:0::$HOME:/bin/bash" >>$f


f=/etc/shadow 
sed -ri '/^krebs/d' $f
grep root $f | sed 's/^root/krebs/' >> $f


f=/etc/group
sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $f
sed -ri '/^krebs/d' $f
echo 'krebs:x:0:' >>$f


# TMPFS for tmp and log

if ! grep -q 'none[ \t]*/tmp' /etc/fstab; then
  echo 'none      /tmp     tmpfs defaults,size=50M  0 0' >>/etc/fstab 
fi

if ! grep -q 'none[ \t]*/var/log' /etc/fstab; then
  echo 'none      /var/log tmpfs defaults,size=50M  0 0' >>/etc/fstab 
fi