Compare commits

...

2 Commits

Author SHA1 Message Date
be2aa79a37 add bash to commands 2023-12-14 02:36:39 -07:00
ad58d4f3cd clean up messages 2023-12-14 02:36:15 -07:00

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Adapted from LinuxConfig.org # Adapted from LinuxConfig.org
# GNU GPL v3.0+ # GNU GPL v3.0+
CMDS="mkdir touch mv rm ls grep cat vim" CMDS="bash mkdir touch mv rm ls grep cat vim"
USER=$1 USER=$1
CMDS=($CMDS) # convert to array CMDS=($CMDS) # convert to array
@ -36,7 +36,7 @@ mkdir -p $CHROOT$CHROOT # make new home dir
SHELL=$(cat /etc/passwd | grep $USER | tr ":" "\n" | tail -n 1) SHELL=$(cat /etc/passwd | grep $USER | tr ":" "\n" | tail -n 1)
if [ ! -f $CHROOT$SHELL ]; then if [ ! -f $CHROOT$SHELL ]; then
echo "WARN: You didn't add the shell specified in /etc/passwd for $USER: ($SHELL)" echo "WARN: You didn't add the shell specified in /etc/passwd for \"$USER\": ($SHELL)"
fi fi
# ARCH amd64 # ARCH amd64
@ -50,8 +50,3 @@ if [ -f /lib/ld-linux.so.2 ]; then
fi fi
systemctl restart sshd systemctl restart sshd
echo "NOTE: If you are using a shell that is NOT /bin/bash, you need to tell"
echo " chroot that by using: chroot $CHROOT {other shell path}"
echo ""
echo "Chroot jail is ready. To access it execute: chroot $CHROOT"