-
-
Save anonymous/eb43eed74a8293d1796c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MOUNT_CMD="/bin/mount" | |
FSTAB="/etc/fstab" | |
RC_LOCAL="/etc/rc.d/rc.local" | |
SSHD_CONF="/etc/ssh/sshd_config" | |
USER_ROOT_DIR="/home/bitrix" | |
MOUNT_DIR="/var/chroot/bitrix/bitrix" | |
CHROOT_DIR="/var/chroot/bitrix" | |
mkdir -p "$MOUNT_DIR" | |
printf "\n\n$USER_ROOT_DIR $MOUNT_DIR none bind 0 0\n\n" >> "$FSTAB" | |
printf "\n\n$MOUNT_CMD $MOUNT_DIR\n\n" >> "$RC_LOCAL" | |
$MOUNT_CMD "$MOUNT_DIR" | |
cp $SSHD_CONF $SSHD_CONF.bak | |
sed -i "s~/usr/libexec/openssh/sftp-server~internal-sftp~" "$SSHD_CONF" | |
printf "\n\nMatch user bitrix\n" >> $SSHD_CONF | |
printf " ChrootDirectory $CHROOT_DIR\n" >> $SSHD_CONF | |
printf " ForceCommand internal-sftp\n" >> $SSHD_CONF | |
printf " AllowTcpForwarding no\n" >> $SSHD_CONF | |
printf " GatewayPorts no\n" >> $SSHD_CONF | |
printf " X11Forwarding no\n\n" >> $SSHD_CONF | |
service sshd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment