LINUX · Permissions · 5 min

Limit a file to its owner

Read permission bits, then tighten access to a synthetic key file.

Not completed

Your task

Change private.key to mode 600. Preserve its content. This is a dummy practice file, not a real credential.

What you’re aiming for

  • The file mode is 600.
  • The synthetic file content is unchanged.

1. Prepare your practice folder

Use a Linux terminal, such as Ubuntu or WSL on Windows. These examples use Linux file permissions. In WSL, create your practice folder in your Linux home directory (~).

Create a new, empty folder for this exercise. If that name already exists, choose another new name. Continue only after you’re inside the new folder.

NEW PRACTICE FOLDER
mkdir opsrung-linux-private-file && cd opsrung-linux-private-file

Run these setup commands in that folder:

SETUP — RUN ONCE
printf 'synthetic-key-not-a-secret\n' > private.key
chmod 644 private.key

2. Try the task

Work toward the goal above. Start by inspecting the files or resources, then use a hint if you need one.

Hint 1

ls -l shows the current permission bits.

Hint 2

The owner should have read/write; group and others should have no permissions.

Hint 3

Use chmod 600 on the named file, then inspect it again.

3. Review your result

Use these commands to look at your result and compare it with the goals. The website does not run or verify them.

REVIEW IN YOUR TERMINAL
ls -l private.key
cat private.key

What you should see

  • The permission field from ls -l private.key begins with -rw-------: only the owner can read and write.
  • cat private.key still prints synthetic-key-not-a-secret.

If your result differs: In WSL, use a practice folder in your Linux home directory. Permissions on Windows-mounted paths can behave differently. This dummy file does not need sudo.

Compare with one possible solution
ONE POSSIBLE SOLUTION
ls -l private.key
chmod 600 private.key
ls -l private.key

Other approaches are fine if you reach the same goal. Opening this solution does not mark the exercise complete.

Finished this exercise?

You decide when you’re done. Your choice is saved in this browser, and you can change it later.