up vote 2 down vote favorite
1
share [g+] share [fb]

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.

link|improve this question

feedback

1 Answer

up vote 4 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
link|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 – Beaks 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
except that one can still su to a locked account, that's not true with an account with no shell. A small point, but with server management it doesn't hurt to be thorough – Beaks Sep 15 '11 at 11:39
@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 – Beaks Sep 16 '11 at 6:43
feedback

Your Answer

 
or
required, but never shown

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