Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What's the difference between useradd and adduser? When/why should I prefer using one or the other?

share|improve this question
6  
What operating system are you referring to? – mfinni Jan 5 '11 at 14:39
1  
Also - catb.org/~esr/faqs/smart-questions.html – mfinni Jan 5 '11 at 14:39
This is a Debian Linux based question. – unixman83 Mar 2 '12 at 18:45

4 Answers

up vote 15 down vote accepted

In the case of Debian and its related distros, adduser is a friendlier interactive frontend to useradd.

share|improve this answer
1  
It is not about friendliness, it's about usage. You can use adduser for interactively adding an account or you can use useradd for batch adding accounts. useradd has also an interactive mode. – tkorkunckaya Sep 26 '12 at 9:49

On Ubuntu, useradd simply creates an entry in the user database (/etc/passwd etc.).

adduser on the other hand also creates a home directory for the user, populates it with the content of /etc/skel and lets you set the password interactively.

share|improve this answer
+1. man useradd : "useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead." – petrus Jan 5 '11 at 15:41
I believe adduser also interactively fills in the GECOS fields – Michael Lowman Jan 5 '11 at 16:07

lrwxrwxrwx. 1 root root 7 Nov 17 13:52 /usr/sbin/adduser -> useradd

One is a "shortcut" / "symbolic link" to the other. So no difference.

This is on redhat linux (and centos / fedora), it may not hold true on other distros.

share|improve this answer
2  
Correct on RH, but some dists such as ubuntu has different binaries. – Ency Jan 5 '11 at 14:48
True, i'll edit my answer. – Sirex Jan 5 '11 at 14:58
3  
Many binaries and scripts alter their behavior based on the command line invocation. – jscott Jan 5 '11 at 15:15

On FreeBSD:
adduser is a "friendly" interactive Q&A way to add local users.
useradd doesn't exist.

share|improve this answer

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.