sudo mkdir -p /opt/myapp && sudo chown deploy:deploy /opt/myapp

Category: VPS Management

sudo mkdir -p /opt/myapp && sudo chown deploy:deploy /opt/myapp

Create app directory owned by the deploy user

mkdir -p creates /opt/myapp (and parents, if missing), then chown hands ownership to the deploy account so that user can write, build, and pull without sudo. Keeping the service user as owner avoids running the app as root. If the directory already existed, only the ownership changes.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.