How do I create a new user in Debian without home directory?

link|improve this question

feedback

4 Answers

up vote 6 down vote accepted

Not really sure if you can create a user which doesn't have a home directory specified. That being said, the specified home directory doesn't have to exists. You can call the adduser with the option --no-create-home.

adduser --no-create-home foo

(adduser is usually the preferred higher level tool if called interactively.)

link|improve this answer
feedback

On Debian based systems typically the adduser command is used to create new accounts instead of directly calling useradd.

The adduser option to skip creating a home directory is --no-create-home.

link|improve this answer
feedback

According to the man page of useradd(8) you either want to add the parameter -M to your useradd call or you want to set CREATE_HOME=no in /etc/default/useradd.

-M
Do no create the user's home directory,
even if the system wide setting from
/etc/login.defs (CREATE_HOME) is set to yes.
link|improve this answer
1  
-1, the very first paragraph of useradd(8) tells you, not to use it, but adduser. – hop May 6 '10 at 7:30
feedback
$ useradd joe
$useradd -m joe does the opposite

edit : rtfm ;) http://linux.die.net/man/8/useradd

link|improve this answer
does the opposite? doesnt it just "make" the user? – HannesFostie May 6 '10 at 7:04
useradd -m creates the home dir (for instance /home/joe) – Kronick May 6 '10 at 7:11
Depending on the settings for $CREATE_HOME in /etc/default/useradd the second command certainly does not do the opposite… – joschi May 6 '10 at 7:12
ain't you confusing -m and -M (in capitals) ? -m, --create-home The user's home directory will be created if it does not exist. The files contained in SKEL_DIR will be copied to the home directory if the -k option is used, otherwise the files contained in /etc/skel will be used instead. Any directories contained in SKEL_DIR or /etc/skel will be created in the user's home directory as well. The -k option is only valid in conjunction with the -m option. The default is to not create the directory and to not copy any files. – Kronick May 6 '10 at 7:21
1  
-1, the very first paragraph of useradd(8) tells you, not to use it, but adduser. – hop May 6 '10 at 7:29
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

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