e Learning

What is the Difference Between useradd and adduser Commands in Linux

In Linux more often you will see there is more than one Linux command available to do the same task. So when it comes to adding new users to the system most Linux distributions has two commands. Two commands are useradd and adduser. So what is the difference between useradd and adduser in Linux? Do they both always work the same way?

Even Though both can be used to create users, They do not always do the same thing. Depends on the Linux distribution two commands may behave differently.

Debian Based Distros Debian / Ubuntu / Linux mint

If you are using a debian based Linux distribution, then you should always use the adduser command. The main difference is adduser in Debian by default creates the user home directory and also prompts for a new password.

But useradd in Debian by default does not create user home directory and do not setup password and basic configuration. Debian itself describes useradd as a low level command, so you should always use the adduser command to create new users.

Difference Between useradd and adduser Commands in Linux

RedHat Based Linux Distributions RHEL / CentOS / Oracle Linux

In RedHat based Linux distributions there is no difference between useradd and adduser, both commands work exactly the same way. In fact, if you looked at the path of the adduser command you will see that adduser is a symbolic link to useradd.

ls -l $(which adduser)

Conclusion

So if you are running a Debian based distribution(Ex : Debian, Ubuntu Linux Mint) always uses the adduser command. In RedHat and CentOS you can use either command. But having said that, I would recommend to use the useradd in RedHat and CentOS since it is the original version.