Linux & VPS

Fix "Permission denied" on Linux (chmod & chown Explained)

bash: ./start.sh: Permission deniedPermission denied (publickey)
5 min read Updated 12 June 2026 ESAGAMES Team

"Permission denied" means the user you're running as doesn't have rights to that file or folder. Two commands fix almost every case — once you know which one you need.

First: who owns it and what are its permissions?

Run ls -l to see ownership and permission bits before changing anything:

ls -l start.sh
# -rw-r--r-- 1 gameuser gameuser 482 Jun 12 10:00 start.sh
#  ^perms       ^owner   ^group

Case 1: a script won't execute

"./start.sh: Permission denied" usually means the file isn't marked executable. Add the execute bit:

chmod +x start.sh
./start.sh

Case 2: wrong owner

If a service runs as gameuser but the files are owned by root, it can't write to them. Give ownership to the right user (recursively for a whole folder):

chown -R gameuser:gameuser /home/gameuser/server

Understanding chmod numbers

Permissions are read (4), write (2), execute (1), added per group of owner/group/others:

  • chmod 755 — owner full, everyone else read+execute (good for scripts/folders).
  • chmod 644 — owner read+write, others read (good for normal files).
  • chmod 600 — owner only (good for keys and secrets).
Never use chmod 777

Setting 777 makes a file writable by everyone — a security hole, not a fix. If 777 "solves" it, the real problem is ownership; use chown instead.

"Permission denied (publickey)" is different

That specific SSH message is about key auth, not files. Your SSH key isn't accepted — check the key is in ~/.ssh/authorized_keys and that .ssh is 700 and the file is 600.

If it won't run, it's usually chmod +x. If a service can't write, it's usually chown. Reach for 777 never.

Managed servers, no Linux required

Prefer not to touch the command line? Our managed game hosting handles permissions, updates and security for you.

Managed hosting
FAQ

Frequently asked questions

What does chmod +x do?

It adds the "execute" permission to a file, letting you run it as a program or script (./file). Without it, Linux refuses to execute the file even if you own it.

When should I use chown instead of chmod?

Use chown when the file is owned by the wrong user — for example a service running as one user can't write files owned by root. chmod changes what actions are allowed; chown changes who owns the file.

Is chmod 777 safe?

No. 777 lets any user on the system read, write and execute the file. It's almost never the right fix and is a real security risk. Fix ownership with chown and use 755/644 instead.

Knowledge base

Related articles

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.

Payments Secure checkout with cards, banking apps and digital wallets.

Choose the payment flow that fits your stack and region without leaving the platform.

Pay by Zen Visa Mastercard Paysafecard PaysafeCash Skrill Trustly Bancontact UnionPay iDeal WebMoney