Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 need help adding a system user to my CentOS server. I have two commands that works on Ubuntu Server, however I have to find a replacement for CentOS while keeping the same result. The commands are:

sudo adduser --system --shell /bin/sh --gecos 'Git Version Control' --group --disabled-password --home /home/git git
sudo adduser --disabled-login --gecos 'GitLab' gitlab

The options that I can't find on CentOS are --system, --disabled-password and --disabled-login.

share|improve this question
up vote 5 down vote accepted

You want to take a look at man useradd. You seem to have a good grasp of what you want to do but adduser = useradd in RHEL/CentOS.

  • -r = --system
  • For the other options, I think you just want to lock the account with passwd -l <username> after the account is created.

Make sure empty passwords are not allowed by PAM;

Look in /etc/pam.d/system-auth and /etc/pam.d/password-auth and remove nullok from the lines (if applicable.)

Ubuntu's adduser
& useradd

share|improve this answer
-r doesn't create the homedir. What if I need a system user which can login not via password but via ssh and with his own user home directory? – Stefano Jan 18 '13 at 19:43
Right, -m creates the home directory, -r just makes the UID < 500 which is convention for a system account. Look at all the options available for useradd, there aren't too many. – Aaron Copley Jan 18 '13 at 19:44
can I use -r and -m together? – Stefano Jan 18 '13 at 19:44
Sure, can! They are not mutually exclusive. – Aaron Copley Jan 18 '13 at 19:45
one last question: in the commands of Ubuntu I have the --group option which (from the docs) when combined with --system, creates a group with the same name and ID as the system user. If not combined with --system, a group with the given name is created. As on Ubuntu the --system option is specified, what should I do on CentOS to get the same result? – Stefano Jan 18 '13 at 19:50

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.