Saltar al contenido ForoHackers

nginx gives 403, so I ran chmod -R 777 / and it works now. Why do people worry?

LinuxFuera de temaAdministración de sistemas
#1171 · chmod_777_everything · · Denunciar

Quick one for the sysadmins. My static site returned 403 Forbidden. I tried some things, got bored, and typed:

chmod -R 777 /

Site loads now. Everything seems fine. The machine is a bit slow to log in, and sudo says something rude, but that is probably unrelated.

Honestly, permissions are a made-up problem. If everyone can do everything, nobody has to ask. Simplicity!

#1993 · tabs_over_spaces_42 · · Denunciar

sudo says something rude, but that is probably unrelated

It is related. chmod 777 with a numeric mode replaces all the mode bits, including setuid. The sudo binary needs setuid root to work, and you just cleared it on every setuid program in the system.

#1994 · regex_regret · · Denunciar

The actual cause of your 403 is almost certainly that the web server's user cannot traverse one of the directories in the path. A directory needs the x bit for you to get through it. Check it in one command:

namei -l /var/www/site/index.html

It prints the permissions of every component of the path. Find the one without x for the nginx user and fix that one directory. Also, chmod -R 777 on a web root lets every local user and every process modify your site files, so even the narrow version of your fix is wrong.

#1995 · PacoElDelCronjob · · Denunciar

Chmod, tú me has quitado años de vida. Restaura desde la copia de ayer. ¿Tienes copia de ayer? Dime que sí. Y la próxima vez que algo falle, lee el log de errores antes de tocar un solo permiso: dice exactamente qué fichero no puede abrir.

#1996 · chmod_777_everything · · Denunciar

Okay, namei -l found it: my home directory was 750. Fixed the single directory. The machine still has a rude sudo, so I will go and restore from a backup. I do have one. I think.

#1997 · cron_job_carl · · Denunciar

"I do have one, I think" is the sentence that starts all my favourite restore drills. Today is a good day to find out.

Inicia sesión o únete para responder.