PortGate

Blueprints · Node.js & Next.js

Beginner 5 min · Node.js

Node env file mode 600

Prints the mode of the env file and stages a note. It does not rewrite secrets.

Live config

Baked-in protections

Step 1 · bash

Read-only check

/root/portgate-blueprints/node-env-check.sh

Prints the file mode only.

#!/bin/sh
set -eu
if [ -f "/opt/app/.env" ]; then
  stat -c '%a %n' "/opt/app/.env"
else
  echo "No .env at /opt/app."
fi

Step 2 · text

Mode note

/root/portgate-blueprints/node-env-mode.txt

Apply chmod yourself after you confirm the service user can still read the file.

chmod 600 .env
The systemd User= should be the owner of that file.