Hardening your Termux setup

Hardening is the work of shrinking what an attacker can reach. This set covers the listeners on your device, reading a permission string, and confirming that your shell is not running as root.

4 questions 1 task Read the lesson

Questions

Each one is marked as you go, and the explanation arrives straight after, which is the part worth reading.

4 questions, marked as you go.

1 What does netstat -tuln show you?
2 Your notes.txt shows -rw-rw-rw-. What is wrong, and how do you fix it?
3 What does id tell you on Termux?
4 The lesson notes that 6 is read plus write and 4 is read only. What does chmod 644 do to a file?

Tasks

These need your own device. Run the command in Termux, then paste what it printed. The marking looks at what the output means, so spacing, version numbers and ordering do not matter. If you have not installed anything yet, the lesson covers the setup.

Lock a directory and a file down

This makes a private directory, puts a file inside it, and then tightens both. Read the two octal modes printed at the end, and the permission string above them.

Run this in Termux On your own device. Nothing on this page executes it. The command runs in your terminal, and this box only reads what you paste back.

mkdir -p ~/private; printf "secret\n" > ~/private/notes.txt; chmod 600 ~/private/notes.txt; chmod 700 ~/private; ls -l ~/private/notes.txt; stat -c "%a %n" ~/private ~/private/notes.txt
Marking your own work Both halves of this are checked in your browser, with no server involved, so nothing stops you from pasting output you did not run. The tasks are written so that the easiest way to pass one is to actually do it and read the result, which is the whole intention.

All sets Read the lesson