awx

← Blog

Walk-through · 17 November 2026

How to practise Linux on a computer you can break

Learn chmod, pipes, grep and cron on a computer where a mistake costs nothing. This post follows a real run: we practised, broke the computer on purpose, asked an agent to fix it, and started again with a clean one.

Most Linux courses ask you to practise as root, on a machine you cannot afford to damage. Many students are afraid to try the risky commands on their own laptop, and that is the right instinct. A computer on awx is separate from your laptop and from everyone else's computers. If you ruin it, you delete it and make another.

We used a Small computer on a test account. We typed the commands ourselves in the Terminal tab, and only called the agent when something broke. Not everything worked the way we expected, and that is in here too.

Awi the cat agent shrugs

Make the practice computer

On Computers press New computer. We named it practice-box and kept Small, which is RM0.03 an hour while it runs and nothing while it sleeps. The form also shows the disk (5 GiB) and the system (Ubuntu 24.04).

The New computer form with the name practice-box, Small selected at RM0.03 an hour, a 5 GiB disk, and a summary: 5 GiB disk, Ubuntu 24.04
Small is enough for the terminal.

It was ready in seconds. Open the Terminal tab and you are the user agent, who may use sudo. Notice that the prompt shows the computer's id, computer-3a361b93, and not the name you typed.

Pipes and grep

A pipe sends the output of one command into the next. We counted installed packages, found the biggest folders, and listed the programs using the most memory:

dpkg -l | wc -l                       # how many lines in the package list
dpkg -l | grep -c python3             # how many lines mention python3
du -sh /usr/* | sort -h | tail -3     # the three biggest folders
ps aux --sort=-%mem | head -4         # the top memory users
The terminal output: user agent, folder /home/agent, 714 and 67, the folders /usr/local 193M, /usr/share 294M and /usr/lib 1.1G, and the top three processes: xfce4-session, Xvfb and xfdesktop
714 lines in the package list, 67 of them about Python, and /usr/lib is the biggest folder at 1.1 GB.

The desktop programs (xfce4-session, Xvfb, xfdesktop) were the top memory users, because every computer has a desktop you can watch. du over /usr took a few seconds, so be patient with it.

Permissions with chmod

We made a file, took away every permission, tried to read it, and gave the permission back:

echo "my secret" > secret.txt
chmod 000 secret.txt     # no one may read, write or run it
cat secret.txt           # fails, even though you own it
chmod 600 secret.txt     # you may read and write it again
cat secret.txt
The terminal: ls -l shows a file with no permissions, cat says secret.txt: Permission denied, after chmod 600 cat prints my secret, and the agent line from /etc/passwd
---------- means no permissions. Being the owner does not help until you change them back.

The same screen shows the last grep exercise: grep agent /etc/passwd prints the one line of the user file that mentions agent.

A job that runs every minute

cron runs commands on a schedule. On this computer it was not installed: which cron crontab printed nothing. We installed it, which took 28 seconds, set a job, and started the service by hand:

sudo apt-get update -qq
sudo apt-get install -y -qq cron
(crontab -l 2>/dev/null; echo '* * * * * date >> /home/agent/cron.log') | crontab -
sudo cron

The five stars mean every minute of every hour of every day. After about two minutes the log had two lines:

The terminal: cron.log holds two lines, 14:55:01 and 14:56:01, and wc says 2 lines
One line a minute, on the minute.

We started cron ourselves with sudo cron, because nothing starts it for you. A computer that goes to sleep stops every program on it, so you would start cron again after it wakes. We did not test a sleep and wake. If you want something to run while you are away, the Schedules page can run a prompt for you at a set time, as in the morning script post.

How much disk you really have

We made a 2 GiB file to see how disk use is counted, then asked how big our home folder is:

fallocate -l 2G ~/big.bin
du -sh ~          # what our home folder uses
The terminal: big.bin is 2.0G and du says 2.1G for /home/agent
du says our home folder uses 2.1 GB.

Use du for this. Its sibling df -h / is tempting, but it shows the disk that your computer sits on, not your allowance, so it tells you nothing about how much you may use. Your allowance is the disk size of the computer (5 GiB here), and 5 GiB across all of your computers, assets and recordings. The Metrics tab shows where you stand:

The Metrics tab: CPU 0.1%, memory 163 MiB of 1.0 GiB, disk 2.1 GiB of 5.0 GiB, and the line Your storage: 2.1 GiB of 5.0 GiB, and 53 processes
The disk tile and your storage line, with the file in place.

We deleted the file after this. We did not fill the disk up to the limit. The Settings page says that a computer that goes over its disk limit is stopped and its files are kept, so a runaway file cannot take over the machine.

Break it on purpose

Now the point of the post. The classic way to lock yourself out is to change who owns the system files. We tried two things.

First attempt: a surprise. We removed all permissions from the sudo rules file with sudo chmod 000 /etc/sudoers. sudo kept working. Root can read any file whatever its permissions say, and sudo only checks the owner. A mistake you expect to be fatal is sometimes harmless, and that is worth learning too.

Second attempt: a real lock-out. People often hit "permission denied" inside /etc and fix it by taking ownership of the folder. We did exactly that:

sudo chmod 440 /etc/sudoers    # put the permissions back
sudo chown -R agent:agent /etc  # the mistake: give /etc to ourselves
sudo whoami
The terminal: sudo says /etc/sudo.conf and /etc/sudoers are owned by uid 1001, should be 0, and sudo: error initializing audit plugin sudoers_audit; the file now shows owner agent
"Owned by uid 1001, should be 0." sudo refuses to run on files that a normal user owns.

sudo will not trust its rules if a normal user owns them, so it refuses everything. You cannot fix the owner without sudo. We were locked out of our own computer.

Ask the agent to fix it

We opened the Chat tab and told the built-in agent what we had done:

I ran sudo chown -R agent:agent /etc by mistake and now every
sudo command says /etc/sudoers is owned by uid 1001, should be 0.
Can you fix it? If you cannot, tell me exactly why, and what I
should do instead.

The agent ran three commands that only look: who it was and what sudo said, which tools might give it root (su, pkexec), and whether the root account has a password. A fourth command, a search for the Docker socket and for programs that run as root, was marked as risky, so it stopped and asked first:

The chat: the agent's commands listed, and a box that says The agent asks: Run ls -l /var/run/docker.sock and a search for programs with the setuid bit, with Approve and Decline buttons
The agent asks before a risky step. This one only lists files, so we approved it.

Read the command before you press Approve. This one only listed things. When we approved it, the step was marked "Failed" and the agent finished with the words "(no reply)". We asked again for a plain answer:

The agent's answer: No, it can't be fixed from inside this computer. Root has no usable password, there is no root session, no pkexec, no Docker socket and no setuid helper that can edit files, and sudo refuses to run because of the very files that need fixing. You need to act from outside the normal system: reboot into recovery mode and run chown -R root:root /etc
A clear answer: it cannot be fixed from inside.

That is the right answer, and a good one to get. The fix it describes is to boot the machine into recovery mode and reset the owner of /etc. We cannot do that: a computer here has no boot menu that you can reach. We did not check each of the agent's claims one by one. What we did confirm is that sudo refused everything we tried.

Start again

The answer on a computer you cannot reboot into recovery is to delete it and make a new one. Settings has a Delete this computer button at the bottom, and it asks first:

A dialog: Delete practice-box? The computer and everything on it will be deleted. Save files to Assets first if you want to keep them. This cannot be undone. With Cancel and Delete buttons
Everything on the computer goes. Save what you want to keep to Assets first.

We pressed Delete, then New computer again. The new computer was running six seconds after we pressed Create. In its terminal sudo worked, and /etc/sudoers was owned by root again:

The terminal on the new computer: sudo whoami prints root, /etc/sudoers is owned by root, and the home folder lists .ICEauthority, .bash_logout, .bashrc, .cache and .config
The new computer: sudo works, and the home folder is empty of our mess.

Making a computer costs nothing, so a clean start is free. The only thing that costs you is your files, so keep your own work somewhere else. The backup post shows how to save a copy to Assets.

What did not go as planned

When a virtual machine on your own PC is better

A computer here is a normal Ubuntu you use through a terminal and a desktop, but it is not a full virtual machine. You cannot boot it into recovery mode, practise a broken bootloader, load kernel modules, or run Docker inside it. If your course asks for those, use a virtual machine on your own PC (VirtualBox or Multipass are free) or WSL on Windows. A computer on awx suits the everyday commands: files, permissions, pipes, scripts, cron, packages, and the mistakes that come with them.

What it cost

The first computer ran for about ten minutes and the second for about two. At RM0.03 an hour that is about half a sen for the first, and the account balance still read RM0.96 afterwards, because the meter takes whole sen. Creating and deleting computers is free. The built-in agent run did not change the balance. The larger limit to watch is storage: our 2 GiB test file used 2.1 of the 5 GiB for as long as it existed. How running time and credit work has the details.

Cautions

Keep reading

Getting started

Sign in with your Google account and press New computer. Choose Small, open the Terminal tab, and try a command you have been afraid to run.

Open the workbench

Awi the cat agent celebrates with confetti

Awi, signing off.

← All posts