When to use adduser vs useradd?

Hello friends

In ubuntu the difference between them is clear. In other post in this network I wrote a situation about the behavior being different in Fedora than Ubuntu for the adduser command and was indicated to use the useradd command.
It at:

But being curious

  • In Fedora When to use adduser vs useradd?

Thank You

In Fedora Linux, there is no difference. adduser is a symbolic link to useradd.

$ ls -l /usr/sbin/adduser 
lrwxrwxrwx. 1 root root 7 Mar 20 20:00 /usr/sbin/adduser -> useradd

You can use either name, and they’ll do the same thing and act the same.

However, as you’ve noticed, the adduser command does not have exactly the same behavior as adduser from the Debian world (which Ubuntu fits into). So, it might be best to get into the habit of using useradd to reduce possible confusion going back and forth.

6 Likes

There is no obvious difference in those commands on fedora.

# ls -l /usr/sbin/adduser /usr/sbin/useradd
lrwxrwxrwx. 1 root root      7 Mar 20 19:00 /usr/sbin/adduser -> useradd
-rwxr-xr-x. 1 root root 145696 Mar 20 19:00 /usr/sbin/useradd

From the man pages

USERADD(8)                                         System Management Commands                                         USERADD(8)

NAME
       useradd - create a new user or update default new user information

SYNOPSIS

       useradd [options] LOGIN

       useradd -D

       useradd -D [options]

DESCRIPTION
       When invoked without the -D option, the useradd command creates a new user account using the values specified on the
       command line plus the default values from the system. Depending on command line options, the useradd command will update
       system files and may also create the new user's home directory and copy initial files.

       By default, a group will also be created for the new user (see -g, -N, -U, and USERGROUPS_ENAB).

The exact same man page shows for both commands.

1 Like
$ ls -l adduser.8.gz 
lrwxrwxrwx. 1 root root 12 Mar 20 20:00 adduser.8.gz -> useradd.8.gz
4 Likes

Thanks to all for the replies.

I’ve confirmed all the feedback provided.

My unique doubt, is why this approach? Why have the adduser command linked to the useradd command?

I thought about portability from Ubuntu to Fedora about scripts. But it is not viable because the adduser command in Ubuntu uses internally the passwd command. Therefore run the same script in Fedora is not possible because the useradd command does not use the passwd command.

Thanks for your understanding

This has been the case for many years. Ubuntu and Debian used one version and Fedora used the other. Fedora chose to make it possible to use either command interchangeably so users had fewer surprises when the command they were used to using was not available.

Similarly with /bin and /usr/bin/ as well as /sbin and /usr/sbin/