denoland/deno · error · AnyError

'{}' is writable or readable by other users

Error message

'{}' is writable or readable by other users

What it means

Final check in `ensure_secure_temp_dir`: after chmod'ing the directory to 0700, Deno re-reads metadata and refuses to continue if any group/other permission bits (mode & 0o077) are still set. If the filesystem ignored or silently reverted the chmod, the directory could be readable or writable by others, which is unacceptable for temp node_modules.

Source

Thrown at cli/util/temp.rs:212

    );
  }

  let mode = metadata.permissions().mode();
  if mode & 0o077 != 0 {
    dir.set_permissions(std::fs::Permissions::from_mode(0o700))?;
  }

  let metadata = dir.metadata()?;
  if metadata.uid() != current_uid {
    bail!(
      "'{}' is owned by uid {}, not current uid {}",
      path.display(),
      metadata.uid(),
      current_uid
    );
  }
  if metadata.permissions().mode() & 0o077 != 0 {
    bail!(
      "'{}' is writable or readable by other users",
      path.display()
    );
  }

  Ok(())
}

#[cfg(not(unix))]
fn ensure_secure_temp_dir(path: &Path) -> Result<(), AnyError> {
  let metadata = std::fs::symlink_metadata(path)?;
  if metadata.file_type().is_symlink() || !metadata.is_dir() {
    bail!("'{}' is not a directory", path.display());
  }
  Ok(())
}

fn attempt_temp_dir_garbage_collection(

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Move TMPDIR onto a native local filesystem — inside WSL use the ext4 VM's /tmp, not /mnt/c.
  2. Unset the custom TMPDIR and fall back to the system default /tmp.
  3. For NFS/fuse mounts, fix export/mount options so an owner's chmod actually applies.
  4. Or set `export TMPDIR=$HOME/tmp` on a local disk (mkdir -p first).

Example fix

# before: WSL drvfs temp ignores chmod 0700
export TMPDIR=/mnt/c/Users/me/AppData/Local/Temp
deno install   # error: '<dir>' is writable or readable by other users

# after: use the Linux-native temp inside WSL
unset TMPDIR TMP
deno install
Defensive patterns

Strategy: validation

Validate before calling

# probe whether TMPDIR's filesystem honors unix mode changes
probe="$(mktemp -d "${TMPDIR:-/tmp}/permprobe.XXXX")"
chmod 700 "$probe"
[ "$(stat -c %a "$probe")" = "700" ] || echo "TMPDIR does not enforce unix modes: ${TMPDIR:-/tmp}"
rm -rf "$probe"

Prevention

When it happens

Trigger: TMPDIR on a filesystem that does not faithfully apply Unix mode bits: Windows-mounted drvfs (9p) paths inside WSL, NFS with squashing/id mapping, some fuse filesystems, or ACL/DLP layers that re-expose permission bits after a chmod.

Common situations: WSL2 with TEMP pointing at /mnt/c (Windows NTFS through drvfs); NFS home directories exported with root_squash; enterprise endpoint-protection rewriting permissions; Docker volumes on network storage with unusual mount options.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/467483a6bd7dfb23. Report an issue: GitHub.