- Lab
- A Cloud Guru
Creating a Chrooted Environment
This lab will allow you to practice creating a chrooted environment, adding access to Linux commands, along with including shared libraries for these commands. You will create a chrooted jailed environment as well as ensuring the inmates can `cat` out the false escape plans that you will leave behind.
Path Info
Table of Contents
-
Challenge
Create a directory named /home/elba
-
Once logged in to the server, become the root user using the command
sudo su -
. When prompted, enter the cloud_user password shown in the lab’s credentials section. -
Create a directory for
elba
within the/home
directory.mkdir /home/elba
-
-
Challenge
Create a new user called napoleon.
-
Create a new user for your environment named
napoleon
.useradd napoleon
-
-
Challenge
Create the bin and lib64 directories in /home/elba
-
Create two new directories,
bin
andlib64
, within the/home/elba
directory.mkdir /home/elba/{bin,lib64}
-
-
Challenge
Copy /bin/bash into /home/elba/bin/bash.
-
Copy
/bin/bash
into/home/elba/bin/bash
.cp /bin/bash /home/elba/bin/bash
-
-
Challenge
Copy /bin/ls in to /home/elba/bin/ls
-
Copy
/usr/bin/ls
into/home/elba/bin/ls
.cp /bin/ls /home/elba/bin/ls
-
-
Challenge
Copy /bin/cat in to /home/elba/bin/cat
-
Copy
/bin/cat
into/home/elba/bin/cat
.cp /bin/cat /home/elba/bin/cat
-
-
Challenge
Copy the libraries needed for bash, ls, and cat over to /home/elba/lib64.
-
Find and copy the libraries needed for
bash
,ls
, andcat
over to/home/elba/lib64
.ldd /bin/bash /bin/ls /bin/cat
cp /lib64/libtinfo.so.5 /lib64/libdl.so.2 /lib64/ld-linux-x86-64.so.2 /lib64/libselinux.so.1 /lib64/librt.so.1 /lib64/libcap.so.2 /lib64/libacl.so.1 /lib64/libc.so.6 /lib64/libpthread.so.0 /lib64/libattr.so.1 /lib64/libpcre.so.1 /home/elba/lib64
-
-
Challenge
Create the waterloo.txt file in the /home/elba directory
-
Using
vi
, create thewaterloo.txt
file in the/home/elba
directory with instructions on how to escape.vi /home/elba/waterloo.txt
-
-
Challenge
Create a chrooted environment in /home/elba with a bash shell.
-
Using the
chroot
command, create a chrooted environment in/home/elba
with a Bash shell.chroot /home/elba /bin/bash
-
-
Challenge
Confirm commands work.
-
Using the command
pwd
, confirm the present working directory and then confirm that you can use thels
command.pwd
ls
cat
-
-
Challenge
View the contents of waterloo.txt and find out how to escape your environment.
-
View the contents of
waterloo.txt
and find out how to escape your environment.cat waterloo.txt
-
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.