Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to create a user and a group both called subversion on a RHEL 5 system. I looked at the man page for useradd and I guess the command would be just be...

useradd subversion

However, not sure how to avoid creating a home dir. Also, I don't want it to be a user that can log in to the system.

The main purpose is just to provide an owner for a SVN repository.

share|improve this question

3 Answers 3

up vote 18 down vote accepted

You can use the -M switch (make sure it's a capital) to ensure no home directory will be created:

useradd -M subversion

then lock the account to prevent logging in:

usermod -L subversion
share|improve this answer
This isn't a particularly strong answer, the user created by this means still has a shell. And you did not even warn the OP that this was the case. Retrospectively that would be usermod -s /bin/false subversion, or with --shell /bin/false to useradd –  Lee Hambley Sep 14 '11 at 16:55
@beak the account is locked, having a shell is a moot point. –  John T Sep 14 '11 at 22:55
@beak actually only the root user would be able to su to the locked account, but why bother if the person has gained root access already? And setting the shell doesn't do much when a user can run su -s /bin/bash username and bypass that. –  John T Sep 15 '11 at 22:44
thanks for taking the time to have the discussion, you are of course correct; but it pains me to see non-login users with shells defined, it strikes me as lazy, and incase someone is unfamiliar with the system, it's nice that they can't accidentally do something unintended; hackers are a different breed, if they already got a shell on the machine, I think it's basically game over –  Lee Hambley Sep 16 '11 at 6:43
These comments covered exactly the things I was hoping to learn, thanks @Beaks && John T –  Rixius Feb 14 '13 at 20:27

useradd -r subversion

per man useradd:

-r, --system create a system account

The -r flag will create a system user - one which does not have a password, a home dir and is unable to login.

share|improve this answer
this command will even create a group for the user called the same. So the "subversion" user will be in the "subversion" group. Great for when you later want to do "sudo chown -R subversion:subversion /path/to/folder" –  Sebastian Aug 15 '13 at 12:07
with -r alone we can still login though. we need -s /bin/false to disable the user shell. –  c4il Oct 25 '13 at 13:27
@c4il But the only one that can login into them is root, right? I mean, they don't have a password, so I would expect only root to be able to log into them. –  Camilo Martin Jul 12 '14 at 20:48

Another solution to create a system user, using adduser :

adduser --system --no-create-home --group yourusername

You can remove --group if you don't need group yourusername, and --no-create-home if you do need a home for this user.

As mentionned by py4on in comments, on some systems one may need to use the --disabled-login option in order to, well, disable login for this user. It seems to be the default behaviour under Debian, though.

Beware that the numeric ID of the user will be of a system account. You can fix the uid using the --uid option, though.

Finally, note that on some systems (e.g. Fedora) adduser is a symlink to useradd, in which case this answer is not valid.

share|improve this answer
To address "I don't want it to be a user that can log in" add the flag --disabled-login as well (before yourusername) –  py4on Jul 30 at 10:37
@py4on : Though this option is documented in the manpage, it seems to be the default under Debian at least. –  Skippy le Grand Gourou Aug 1 at 19:59

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.