Skip to main content

Unit 8 · System Settings and the Final Run · Lesson 23 of 25

Fixes That Undo Themselves

The /tmp folder, and why a correct fix can vanish at the next restart.

The fix that does not stick

You run the command. The report gives you the points. You restart, and they are gone. Something else is putting the old setting back.

The /tmp folder

/tmp is a shared scratch folder that everyone can write to, which is on purpose. The risk is that being able to write to a folder also means being able to delete things in it, including other people's files.

There is a setting that fixes exactly that, and you can see it at the end of the permissions:

ls -ld /tmp
  drwxrwxrwt   /tmp      ← ends with t. Correct.
  drwxrwxrwx   /tmp      ← ends with x. Anyone can delete anyone's files.

Set it:

sudo chmod +t /tmp

Why that might not be enough

There is a folder of instructions that gets applied at every restart:

ls /etc/tmpfiles.d/

If a file in there describes /tmp with the wrong permissions, it puts them back every time the machine starts. Your chmod was real. It lasted until the restart.

sudo nano /etc/tmpfiles.d/FILENAME    # read it
sudo rm /etc/tmpfiles.d/FILENAME      # if it is the culprit, remove it

Do that first, then set the permission. In the other order the fix gets undone.

The restart test

It is the only way to know your work stuck:

sudo reboot

Log back in, open the Scoring Report, and compare it to the number you had before. Anything that vanished was never really fixed.

Try it yourself

ls -ld /tmp              # does it end with a t?
ls /etc/tmpfiles.d/      # anything in here?

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in CyberPatriot Linux: Tokyo Jujutsu High, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.