6

I just got a CentOS VPS and was reviewing the passwd file and saw this:

mysql:x:498:499:MySQL server:/var/lib/mysql:/bin/bash

Is bash necessary for mysql?

4

The shell may need to be set in some circumstances, for example if you want to initiate jobs remotely over SSH as the mysql user, or through sudo. These aren't common needs. You don't need to have a shell set for cron jobs, /bin/false will do fine.

Giving the mysql user a shell isn't a security hole on its own. The reason it's frowned upon is that compounded with a misconfiguration of some login service, it might allow someone to obtain a shell as mysql. Putting a program that does nothing avoids this — even if an attacker manages to log in as mysql that won't do them any good. It's common to use /bin/false or /usr/sbin/nologin, but /bin/true or any other no-op program would be fine.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.