203k views
3 votes
Research and build a chroot jail that isolates ssh users who belong to the restrictssh group. (You will also need to create the restrictssh group). Next, install an ftp server and configure it to allow anonymous logins. Create a second chroot jail that can be accessed by the anonymous account. You will probably need to create several new user accounts to facilitate testing your setups.

User Joshualan
by
4.1k points

1 Answer

6 votes

Answer:

Step-by-step explanation:

#!/bin/bash

# This script can be used to create simple chroot environment

# Written by LinuxConfig.org

# (c) 2020 LinuxConfig under GNU GPL v3.0+

#!/bin/bash

CHROOT='/var/chroot'

mkdir $CHROOT

for i in $( ldd $* | grep -v dynamic | cut -d " " -f 3 | sed 's/://' | sort | uniq )

do

cp --parents $i $CHROOT

done

# ARCH amd64

if [ -f /lib64/ld-linux-x86-64.so.2 ]; then

cp --parents /lib64/ld-linux-x86-64.so.2 /$CHROOT

fi

# ARCH i386

if [ -f /lib/ld-linux.so.2 ]; then

cp --parents /lib/ld-linux.so.2 /$CHROOT

fi

echo "Chroot jail is ready. To access it execute: chroot $CHROOT"

User RyuuGan
by
4.5k points