Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
thank you for the help! – ErocM Sep 29 '12 at 0:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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