Difference between useradd and adduser commands

Solved
Hello,
I would like to know the difference between the "adduser" and "useradd" commands in Linux.
Thank you for your answers.

13 answers

  1. adduser is an interactive command: it asks you questions, and you must answer them.
    useradd is a non-interactive command, you can use it in a script.
    Basically, you will only use adduser, which does much more for you than useradd (which it calls anyway).

    HTH
    1. adduser is for creating an account and useradd is to create a session in a specific environment!
      1. Under RedHat 5, adduser is just a link to "useradd".


        [root@vm2 gpf]# ll /usr/sbin/ |grep user
        lrwxrwxrwx 1 root Apr 8 2008 adduser -> useradd
        1. I am a beginner with Linux, and when I create a new user with the adduser command, I can log in with this new account. However, when I create a new user with the useradd command, I cannot log in, and I can't even shut down my PC; I have to force it off by pressing the power button.
          1. If you want to know everything, go here:
            http://doc.ubuntu-fr.org/adduser#creer_un_compte_ou_un_groupe_d_utilisateurs_de_maniere_non-interactive
            1. Webmaster
              Re,

              It seems logical to me... it must be the only standard command, other Unix systems must have brought in adduser, so for compatibility there might eventually be a link...
              A priori, for the Linux RH LPI certifications, only the "useradd" command needs to be known
              So that one must be on all distributions, the other is a plus :)

              @++

              "If it's stupid and it works, then it's not stupid"
              1. Moderator
                Hi asevere.
                Under "Suse 8.1," the "useradd" gives the same result, but the "adduser" is unknown to the "bash."
                @+

                JP___ and don't forget little scarab... "google" is your friend! ;-)
                1. Webmaster
                  Hello everyone!

                  Thanks JP for not leaving me all alone :)
                  This is the result on my Mandrake 9.0
                  I haven't tested it with others yet
                  @++

                  "If it’s stupid and it works, then it’s not stupid"
                  1. useradd and adduser are used to add a user in Linux, so they have the same function.
                2. Moderator
                  Hello.
                  Same as "asevere"
                  [root@Mandrake root]# adduser usage: adduser [-u uid [-o]] [-g group] [-G group,...] [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name adduser -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire ] [root@Mandrake root]# useradd usage: useradd [-u uid [-o]] [-g group] [-G group,...] [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name useradd -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire ]
                  For your information: Mandrake 9.0
                  @+
                  JP___ and don't forget little scarab... "google" is your friend! ;-)
                  1. Webmaster
                     [shell]# adduser usage: adduser [-u uid [-o]] [-g group] [-G group,...] [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name adduser -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire ] [shell]# useradd usage: useradd [-u uid [-o]] [-g group] [-G group,...] [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] name useradd -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire ] [shell]# ll /usr/sbin/adduser lrwxr-xr-x 1 root root 7 mai 7 21:57 /usr/sbin/adduser -> useradd* 


                    In my case... (Maybe not for everyone) it's the same thing :)
                    "If it's stupid and it works, then it isn't stupid"
                    1. It’s quite surprising.
                      What system are you using?
                  2. Hello,
                    The syntax is roughly as follows (it depends on the
                    version of Unix/Linux):

                    usage: useradd [-u uid [-o] [-i]] | -g group | -G group[[,group]...] | -d dir |

                    -s shell | -c comment | -m [-k skel_dir] | -f inactive | -e expire ] login
                    useradd -D [-g group | -b base_dir | -f inactive | -e expire ]

                    USAGE: /sbin/adduser <login id> <name> <user id> <home directory>

                    The easiest way is to run a man on both commands
                    and test them to create users

                    Best regards,
                    1. I'm sorry, but your answer doesn't help me better understand the difference between these two commands :)
                      You indicate that the syntax is different (OK, adduser is not useradd), as well as the options (what are the different options between the two commands?), but that the result is the same (how is that possible, with different options?).

                      Basically, when should I use adduser, and when should I use useradd?
                      1. Hello;
                        The syntax is different... and the options
                        but the result is the same.