Software⏱️ 4 min read📅 2026-06-15

How to Fix: Jailkit on a Mac: "ERROR: <jaildir> is not owned by root:root!" / "ERROR: jail directory <jaildir> is not safe"

Jailkit error on Mac: fix ownership issue with /Users/jail directory.

Quick Answer: Change the ownership of / to root:root using sudo chown -R root:root /

Jailkit is a popular tool used to create isolated user environments on Unix-like systems, including macOS. The error 'ERROR: is not owned by root:root!' and 'ERROR: jail directory is not safe' occurs when Jailkit cannot determine the ownership of the parent directory of the jail. This issue affects users who want to create a jailed user for limited SSH access on their Mac.

This error can be frustrating, especially when following established guides like the one from the Ubuntu StackExchange answer. However, understanding the root cause and applying the correct fix will resolve the issue and allow you to successfully create your jail.

⚠️ Common Causes

  • The primary reason for this error is that the parent directory of the jail (in this case, /Users/jail) needs to be owned by root:root. However, on macOS, the default ownership of the root user's home directory is root:wheel, which includes other users with wheel privileges. This can cause issues when trying to determine the correct ownership for Jailkit.
  • An alternative reason could be that the jail directory itself is not properly configured or set up, leading to incorrect ownership and safety checks by Jailkit.

🔧 Proven Troubleshooting Steps

Change Parent Directory Ownership

  1. Step 1: To resolve this issue, you need to change the ownership of the parent directory of your jail to root:root. This can be done using the `chown` command with the `-R` option for recursive changes.
  2. Step 2: Open the Terminal and navigate to the parent directory of your jail (in this case, /Users). Run the following command: `sudo chown -R root:root /Users`. This will change the ownership of all files and subdirectories within the /Users directory.
  3. Step 3: After running this command, verify that the ownership has been changed by checking the output of the `ls -ld` command again. If successful, you should see the correct ownership displayed (in this case, drwxr-xr-x+ 13 root root 442 Jan 12 15:21 /Users/jail).

Alternative Fix

  1. Step 1: Another approach to resolve this issue is to create a new parent directory for your jail that is owned by root:root. This can be done using the `mkdir` and `chown` commands.
  2. Step 2: Create a new parent directory for your jail using the following command: `sudo mkdir /Users/jailroot`. Then, change its ownership to root:root using the following command: `sudo chown -R root:root /Users/jailroot`. Finally, move your existing jail files into this new directory using the `mv` command: `sudo mv /Users/jail /Users/jailroot`. This will ensure that the entire directory tree leading up to the chroot jail is owned by root:root.

✨ Wrapping Up

By following these steps and understanding the root cause of the error, you should be able to resolve the 'ERROR: is not owned by root:root!' / 'ERROR: jail directory is not safe' issue with Jailkit on your Mac. Remember to test your jailed user environment thoroughly after making these changes to ensure it functions as expected.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions