From 50525dc1245927b3c4f95d8f0f75de9fc3b8e6ee Mon Sep 17 00:00:00 2001 From: Oliver Atkinson Date: Thu, 14 Dec 2023 01:50:20 -0700 Subject: [PATCH] added sshd config rule --- .local/bin/chroot-gen | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.local/bin/chroot-gen b/.local/bin/chroot-gen index de8b8a1..fb38749 100755 --- a/.local/bin/chroot-gen +++ b/.local/bin/chroot-gen @@ -4,15 +4,16 @@ CMDS="mkdir touch mv rm ls grep cat vim" USER=$1 +CHROOT=$(eval echo ~$USER) +CMDS=($CMDS) # convert to array + if ! id "$USER" 2&>/dev/null; then echo 'INFO: User not found' echo 'Creating...' useradd -m $USER + printf "Match User $USER\n ChrootDirectory $CHROOT$CHROOT" >> /etc/ssh/sshd_config.d/70-$USER.conf fi -CHROOT=$(eval echo ~$USER) -CMDS=($CMDS) # convert to array - # cp in all commands and dependencies for cmd in "${CMDS[@]}"; do for dep in $( ldd $(which $cmd) | grep -v dynamic | cut -d " " -f 3 | sed 's/://' | sort | uniq ); do