Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to create an unprivileged user to run my RhodeCode server and Celery daemon on a CentOS instance. I think the accepted definition of this is no home directory, login disabled, and no shell access? Looking over the man page for adduser I just don't see an intuitive method for doing this. Any suggestions are appreciated. Thanks.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

From here (centos.org)

useradd (which is the actual binary the runs when you call adduser, it just behaves differently. See here about that.) has an flag -r which is documented as follows:

-r   Create a system account with a UID less than 500 and without a home directory

Which sounds like what you want to do.

share|improve this answer

I think I should link here two answers from serverfault:

Basically -r means "set account as a system one" -- "no expiration", etc -- and the full spell may look like

useradd -s /bin/false -r -M <username>


useradd -s /usr/sbin/nologin -r -M -d /nonexistent <username>

or similar )

NB. For things like samba one may also want to provide this user with a password and may be also add /usr/sbin/nologin to /etc/shells :

# `which nologin` >> /etc/shells

PS. And yes, looking for the same thing at serverfault, askubuntu -- and here -- seems a bit odd to me; is there a way to run a meta-search on, say, all stackoverflow sites ?

share|improve this answer
As for meta-search -- any "native" option is missing for the moment, but there is custom Google search for stack exchange –  ジョージ Oct 21 '12 at 4:45
I've seen services like named using /sbin/nologin in /etc/passwd. So how do they start their services? –  Antarus Oct 30 '13 at 6:20

You're looking for the -r option.

share|improve this answer
I just created a user using adduser -s /sbin/nologin -M rhodecode, but the -r option does seem to be what I'm looking for. What is the difference between using -r and what I did? I'm a shell scripting noob, sorry. –  Lester Peabody Oct 7 '11 at 18:15
I recommend you look at the useradd(8) man page to see how it affects the user created. –  Ignacio Vazquez-Abrams Oct 7 '11 at 18:25

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.