aboutsummaryrefslogtreecommitdiffstats
path: root/ftp/vsftpd/pkg-install
blob: b9123aae27bbe9ff679132bf163ebefd909d9d3f (plain) (blame)
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
32
33
34
35
36
#!/bin/sh
# $FreeBSD$
#

if [ "$2" != "PRE-INSTALL" ]; then
    exit 0
fi

if ! pw groupshow operator >/dev/null; then
    if pw groupadd operator 5; then
        echo "Added group operator for vsftpd"
    else
        echo "Failed to add group operator as gid 5" >&2
        exit 1
    fi
fi

if ! pw usershow ftp >/dev/null; then
    if pw useradd ftp -g operator -u 14 -h - -d /var/ftp -s /nonexistent -c "Anonymous Ftp"; then
        echo "Added user ftp for vsftpd"
    else
        echo "Failed to add user ftp as gid 14" >&2
        exit 1
    fi
fi

# uid=14(ftp) gid=5(operator) groups=5(operator)
view="$(id ftp)"
view="${view%% *}"
if test "${view}" = "uid=14(ftp)"; then
    exit 0
fi

echo "User ftp should have uid 14"; >&2
exit 1
# eof