commit | author | age
|
6a95c8
|
1 |
#!/bin/bash |
D |
2 |
|
|
3 |
# Add user to the jailkit chroot |
|
4 |
|
|
5 |
# |
|
6 |
# Usage: ./create_jailkit_user username /path/to/chroot/ /home/webuser /bin/bash web2 /home/web2 |
|
7 |
# |
|
8 |
|
|
9 |
# Sanity check |
|
10 |
|
|
11 |
if [ "$1" = "" ]; then |
|
12 |
echo " Usage: ./create_jailkit_user username /path/to/chroot/ /home/webuser /bin/bash" |
|
13 |
exit |
|
14 |
fi |
|
15 |
|
|
16 |
|
|
17 |
CHROOT_USERNAME=$1 |
|
18 |
CHROOT_HOMEDIR=$2 |
|
19 |
CHROOT_USERHOMEDIR=$3 |
|
20 |
CHROOT_SHELL=$4 |
|
21 |
CHROOT_P_USER=$5 |
|
22 |
CHROOT_P_USER_HOMEDIR=$6 |
|
23 |
|
|
24 |
### Reconfigure the chroot home directory for the user ### |
526b99
|
25 |
usermod --home=$CHROOT_HOMEDIR/.$CHROOT_USERHOMEDIR $CHROOT_USERNAME 2>/dev/null |
6a95c8
|
26 |
|
65584a
|
27 |
### Add the chroot user ### |
TB |
28 |
jk_jailuser -n -s $CHROOT_SHELL -j $CHROOT_HOMEDIR $CHROOT_USERNAME |
|
29 |
|
6a95c8
|
30 |
### We have to reconfigure the chroot home directory for the parent user ### |
D |
31 |
if [ "$CHROOT_P_USER" != "" ]; then |
526b99
|
32 |
usermod --home=$CHROOT_HOMEDIR/.$CHROOT_P_USER_HOMEDIR $CHROOT_P_USER 2>/dev/null |
6a95c8
|
33 |
fi |