Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

4 Answers 4

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.)

share|improve this answer

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.

share|improve this answer

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.
share|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
$ useradd joe
$useradd -m joe does the opposite

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

share|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) –  Razique 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. –  Razique 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

Your Answer

 
discard

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.