diff --git a/bin/vhost-add.sh b/bin/vhost-add.sh index beb5ce0..1f4ce38 100755 --- a/bin/vhost-add.sh +++ b/bin/vhost-add.sh @@ -56,7 +56,7 @@ if [ -d /usr/jails/$username ]; then if [ ! -d /usr/jails/$username/srv/www/$virtualhost ]; then install -d -o $username -g $username -m 755 /usr/jails/$username/srv/www/$virtualhost mount --bind /srv/www/$virtualhost /usr/jails/$username/srv/www/$virtualhost - echo "/srv/www/$virtualhost /usr/jails/$username/srv/www/$virtualhost none bind 0 0" >> /etc/fstab + echo "/srv/www/$virtualhost /usr/jails/$username/srv/www/$virtualhost none bind 0 0" >> /etc/fstab.jails fi fi diff --git a/bin/vhost-del.sh b/bin/vhost-del.sh index f7694ef..b8e6844 100755 --- a/bin/vhost-del.sh +++ b/bin/vhost-del.sh @@ -46,9 +46,9 @@ if grep -q "^/dev/sda /usr/jails/$username/srv/www/$virtualhost " /etc/mtab; the umount /usr/jails/$username/srv/www/$virtualhost fi -# if virtualhost mount in fstab exists remove it -if grep -q "/usr/jails/$username/srv/www/$virtualhost" /etc/fstab; then - sed -i "\|/usr/jails/$username/srv/www/$virtualhost|d" /etc/fstab +# if virtualhost mount in fstab.jails exists remove it +if grep -q "/usr/jails/$username/srv/www/$virtualhost" /etc/fstab.jails; then + sed -i "\|/usr/jails/$username/srv/www/$virtualhost|d" /etc/fstab.jails fi # if virtualhost symlink exists in jail remove it diff --git a/bin/vhost-user-del.sh b/bin/vhost-user-del.sh index 6229d24..a4b33aa 100755 --- a/bin/vhost-user-del.sh +++ b/bin/vhost-user-del.sh @@ -35,8 +35,8 @@ if /bin/grep -q "^/dev/sda /usr/jails/$username/srv/www/" /etc/mtab; then exit 1 fi -# check for virtualhost jail mount(s) in fstab -if /bin/grep -q " /usr/jails/$username/srv/www/" /etc/fstab; then +# check for virtualhost jail mount(s) in fstab.jails +if /bin/grep -q " /usr/jails/$username/srv/www/" /etc/fstab.jails; then echo user \"$username\" has one or more jailed vhost mounts exit 1 fi @@ -62,9 +62,9 @@ if grep -q "^/dev/sda /usr/jails/$username/home/$username " /etc/mtab; then umount /usr/jails/$username/home/$username fi -# if user home dir mount in fstab exists remove it -if grep -q "^/home/$username /usr/jails/$username/home/$username " /etc/fstab; then - sed -i "\|/home/$username /usr/jails/$username/home/$username|d" /etc/fstab +# if user home dir mount in fstab.jails exists remove it +if grep -q "^/home/$username /usr/jails/$username/home/$username " /etc/fstab.jails; then + sed -i "\|/home/$username /usr/jails/$username/home/$username|d" /etc/fstab.jails fi # delete user diff --git a/bin/vhost-user-jail.sh b/bin/vhost-user-jail.sh index 0e3f6df..111c144 100755 --- a/bin/vhost-user-jail.sh +++ b/bin/vhost-user-jail.sh @@ -41,7 +41,7 @@ ln -s /usr/local/sbin/mini_sendmail /usr/jails/$username/usr/sbin/sendmail chmod a+rwx /usr/jails/$username/tmp install -d -o $username -g $username -m 755 /usr/jails/$username/home/$username mount --bind /home/$username /usr/jails/$username/home/$username -echo "/home/$username /usr/jails/$username/home/$username none bind 0 0" >> /etc/fstab +echo "/home/$username /usr/jails/$username/home/$username none bind 0 0" >> /etc/fstab.jails killall jk_socketd jk_socketd jk_jailuser -n -j /usr/jails/$username -s /bin/bash $username diff --git a/install.sh b/install.sh index 96d7ddc..2a486e0 100755 --- a/install.sh +++ b/install.sh @@ -145,6 +145,11 @@ fi cp libexec/command-not-found-handle /usr/local/libexec/command-not-found-handle chmod 755 /usr/local/libexec/command-not-found-handle chown root:root /usr/local/libexec/command-not-found-handle +if ! [ -f "/etc/fstab.jails" ]; then + touch /etc/fstab.jails + chmod 644 /etc/fstab.jails + echo "# /etc/fstab.jails: jail bind mounts information." > /etc/fstab.jails +fi # varnish apt -y install varnish