What is the difference between adduser and useradd? The 2019 Stack Overflow Developer Survey Results Are InWhen to use adduser or useraddRemoving and adding user back again doesn't remove it properlyA command to list all users? And how to add, delete, modify users?Ubuntu 14.04: New user created from command line has missing featuresAt what point is the ~/.bashrc file created?useradd not asking for a password?How can I add a user and set the password for them at the same time?How to log in as guest user via terminal?Arrows do not work, all I see is ^[[A ^[[B^ [[C ^[[DDeny Firefox access to home directoryConfused about groups and adduserWhat do the `--disabled-login` and `--gecos` options of `adduser` command stand for?When you create user using adduser what happens on the system?When to use adduser or useraddpassword does not work with useradd -pDiff between 2 ways changing useradd defaultsCreate another root account with ubuntuuseradd for no home and no logingDifference between adduser and usermod -G -a.bashrc and .bash_profile not created with adduser but created with useradd

What do hard-Brexiteers want with respect to the Irish border?

Am I thawing this London Broil safely?

Is three citations per paragraph excessive for undergraduate research paper?

Is an up-to-date browser secure on an out-of-date OS?

Protecting Dualbooting Windows from dangerous code (like rm -rf)

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

The difference between dialogue marks

What is the most effective way of iterating a std::vector and why?

Did 3000BC Egyptians use meteoric iron weapons?

Can one be advised by a professor who is very far away?

Lightning Grid - Columns and Rows?

Can someone be penalized for an "unlawful" act if no penalty is specified?

When should I buy a clipper card after flying to OAK?

Delete all lines which don't have n characters before delimiter

Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?

Why did Acorn's A3000 have red function keys?

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

Resizing object distorts it (Illustrator CC 2018)

Where to refill my bottle in India?

Is there any way to tell whether the shot is going to hit you or not?

Why can Shazam fly?

Can you compress metal and what would be the consequences?

Is bread bad for ducks?

Apparent duplicates between Haynes service instructions and MOT



What is the difference between adduser and useradd?



The 2019 Stack Overflow Developer Survey Results Are InWhen to use adduser or useraddRemoving and adding user back again doesn't remove it properlyA command to list all users? And how to add, delete, modify users?Ubuntu 14.04: New user created from command line has missing featuresAt what point is the ~/.bashrc file created?useradd not asking for a password?How can I add a user and set the password for them at the same time?How to log in as guest user via terminal?Arrows do not work, all I see is ^[[A ^[[B^ [[C ^[[DDeny Firefox access to home directoryConfused about groups and adduserWhat do the `--disabled-login` and `--gecos` options of `adduser` command stand for?When you create user using adduser what happens on the system?When to use adduser or useraddpassword does not work with useradd -pDiff between 2 ways changing useradd defaultsCreate another root account with ubuntuuseradd for no home and no logingDifference between adduser and usermod -G -a.bashrc and .bash_profile not created with adduser but created with useradd



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








416















What is the difference between the commands adduser and useradd on Ubuntu?










share|improve this question



















  • 17





    Same question on Super User and on Server Fault

    – ændrük
    Sep 15 '13 at 20:37






  • 5





    and also on Unix stackexchange (quite detailed answer)

    – xealits
    Oct 11 '16 at 22:17











  • and it is and stays a good, valid question. The issue is not people asking it in respective contexts, it is that this question needs to be asked at all.

    – foo
    Dec 19 '18 at 15:36


















416















What is the difference between the commands adduser and useradd on Ubuntu?










share|improve this question



















  • 17





    Same question on Super User and on Server Fault

    – ændrük
    Sep 15 '13 at 20:37






  • 5





    and also on Unix stackexchange (quite detailed answer)

    – xealits
    Oct 11 '16 at 22:17











  • and it is and stays a good, valid question. The issue is not people asking it in respective contexts, it is that this question needs to be asked at all.

    – foo
    Dec 19 '18 at 15:36














416












416








416


109






What is the difference between the commands adduser and useradd on Ubuntu?










share|improve this question
















What is the difference between the commands adduser and useradd on Ubuntu?







adduser useradd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 1 '18 at 17:39









Community

1




1










asked Sep 15 '13 at 20:32









Joe CabezasJoe Cabezas

2,2083117




2,2083117







  • 17





    Same question on Super User and on Server Fault

    – ændrük
    Sep 15 '13 at 20:37






  • 5





    and also on Unix stackexchange (quite detailed answer)

    – xealits
    Oct 11 '16 at 22:17











  • and it is and stays a good, valid question. The issue is not people asking it in respective contexts, it is that this question needs to be asked at all.

    – foo
    Dec 19 '18 at 15:36













  • 17





    Same question on Super User and on Server Fault

    – ændrük
    Sep 15 '13 at 20:37






  • 5





    and also on Unix stackexchange (quite detailed answer)

    – xealits
    Oct 11 '16 at 22:17











  • and it is and stays a good, valid question. The issue is not people asking it in respective contexts, it is that this question needs to be asked at all.

    – foo
    Dec 19 '18 at 15:36








17




17





Same question on Super User and on Server Fault

– ændrük
Sep 15 '13 at 20:37





Same question on Super User and on Server Fault

– ændrük
Sep 15 '13 at 20:37




5




5





and also on Unix stackexchange (quite detailed answer)

– xealits
Oct 11 '16 at 22:17





and also on Unix stackexchange (quite detailed answer)

– xealits
Oct 11 '16 at 22:17













and it is and stays a good, valid question. The issue is not people asking it in respective contexts, it is that this question needs to be asked at all.

– foo
Dec 19 '18 at 15:36






and it is and stays a good, valid question. The issue is not people asking it in respective contexts, it is that this question needs to be asked at all.

– foo
Dec 19 '18 at 15:36











7 Answers
7






active

oldest

votes


















363















useradd is native binary compiled with the system. But, adduser is
a perl script which uses useradd binary in back-end.



adduser is more user friendly and interactive than its back-end
useradd. There's no difference in features provided.




Source: What's the difference between “adduser” and “useradd”?






share|improve this answer




















  • 54





    add useradd command wont create '/home/username' directory but adduser command will

    – Deepen
    Apr 30 '14 at 16:12







  • 56





    useradd with the -m option will create the home directory.

    – richsinn
    Aug 8 '14 at 0:02






  • 10





    The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

    – Anders
    Sep 22 '14 at 14:14






  • 18





    I have to google this every time... How can I help myself remember which is which?

    – Quentin Skousen
    Jan 22 '16 at 20:10






  • 11





    @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

    – pzkpfw
    May 1 '16 at 10:41


















143














Always use adduser (and deluser when deleting users) when you're creating new users from the command line. (If you're writing a script, especially if you aim for portability, you might want to use the lowlevel utilities instead – and adduser/deluser might not be available on all distros, e.g. on SuSE.)



The useradd, userdel and usermod commands are lowlevel utilities which are there for historical reasons, while adduser/deluser Do The Right Thing™. (I remember which to use by thinking that user* comes after adduser/deluser in the alphabet, and therefore is "worse".)



According to the respective manpages (on Ubuntu 12.04 Precise Pangolin, i.e. a Debian derivative system).



Manpage for adduser says:



(Emphasis added.)




adduser and addgroup add users and groups to the system according to command line
options and configuration information in /etc/adduser.conf. They are friendlier
front ends to the low level tools like useradd, groupadd and usermod programs
,
by default choosing Debian policy conformant UID and GID values, creating a home
directory with skeletal configuration, running a custom script, and other features.
adduser and addgroup can be run in one of five modes:




Manpage for useradd says:




useradd is a low level utility for adding users. On Debian, administrators should
usually use adduser(8) instead.




See also: What's the difference between “adduser” and “useradd”? (on SuperUser)






share|improve this answer




















  • 6





    I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

    – Mads Skjern
    Mar 13 '15 at 12:27






  • 21





    I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

    – Wernight
    Apr 15 '15 at 10:47







  • 2





    I tried adduser on openSUSE, and it's not there.(13.2)

    – cst1992
    May 24 '16 at 7:18






  • 1





    @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

    – zrajm
    May 24 '16 at 15:40






  • 1





    useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

    – answerSeeker
    Feb 10 '17 at 0:53


















16














adduser: add user with full profile and info (pass, quota, permission, etc.)



useradd: add user with his name only (if you want to add a temp user with only a name,other info not required)






share|improve this answer




















  • 1





    +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

    – Ricalsin
    Aug 9 '14 at 2:38


















8














Another couple of differences, that lead to specific scenarios where useradd might be preferable.




  1. In some newer distros, including Ubuntu 14.4, adduser will prompt for information such as password and "gecos" (data for the finger command). This means it can be less suitable for calling from a script (credit: already mentioned in a comment by Wernight).



    The prompts can be suppressed by passing null arguments:



    adduser --disabled-password --gecos "" USER


  2. useradd allows you to pass multiple additional groups to add a user to by means of the -G option. adduser seems to require that you call the command once for each group to add.






share|improve this answer

























  • Doesn't work on ubuntu 16.04.

    – answerSeeker
    Feb 10 '17 at 0:55


















7














adduser is friendlier in that it sets up the account's home folders and other settings (e.g. automatically loading system stats and notifications on login), whereas useradd just creates the user.






share|improve this answer


















  • 1





    Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

    – ychaouche
    Feb 21 '18 at 11:38


















3














Basic difference is "adduser" will create home directory & add skeleton files to that directory where "useradd" wont create any home directory & skeleton files !



adduser try :



Adding user `try' ...
Adding new group `try' (1001) ...
Adding new user `try' (1001) with group `try' ...
Creating home directory `/home/try' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for try
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y


useradd try1 :



# ll /home/
total 20
drwxr-xr-x 5 root root 4096 Oct 26 15:52 ./
drwxr-xr-x 22 root root 4096 Oct 26 15:47 ../
drwx------ 8 ashishk ashishk 4096 Oct 26 15:50 ashishk/
drwxr-xr-x 3 root root 4096 Oct 14 13:02 .ecryptfs/
drwxr-xr-x 2 try try 4096 Oct 26 15:52 try/
root@chef-workstation:/home/ashishk#





share|improve this answer























  • Wrong. See previous comment

    – ychaouche
    Feb 21 '18 at 11:42


















0














I'll also point out that adduser does not always have the -M option and also does not respect the --system flag which specifically says:




Note that useradd will not create a home directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You have to specify the -m options if you want a home directory for a system account to be created.




If you're trying to create a system user without a home directory then use useradd --system -M.






share|improve this answer








New contributor




blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f345974%2fwhat-is-the-difference-between-adduser-and-useradd%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    7 Answers
    7






    active

    oldest

    votes








    7 Answers
    7






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    363















    useradd is native binary compiled with the system. But, adduser is
    a perl script which uses useradd binary in back-end.



    adduser is more user friendly and interactive than its back-end
    useradd. There's no difference in features provided.




    Source: What's the difference between “adduser” and “useradd”?






    share|improve this answer




















    • 54





      add useradd command wont create '/home/username' directory but adduser command will

      – Deepen
      Apr 30 '14 at 16:12







    • 56





      useradd with the -m option will create the home directory.

      – richsinn
      Aug 8 '14 at 0:02






    • 10





      The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

      – Anders
      Sep 22 '14 at 14:14






    • 18





      I have to google this every time... How can I help myself remember which is which?

      – Quentin Skousen
      Jan 22 '16 at 20:10






    • 11





      @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

      – pzkpfw
      May 1 '16 at 10:41















    363















    useradd is native binary compiled with the system. But, adduser is
    a perl script which uses useradd binary in back-end.



    adduser is more user friendly and interactive than its back-end
    useradd. There's no difference in features provided.




    Source: What's the difference between “adduser” and “useradd”?






    share|improve this answer




















    • 54





      add useradd command wont create '/home/username' directory but adduser command will

      – Deepen
      Apr 30 '14 at 16:12







    • 56





      useradd with the -m option will create the home directory.

      – richsinn
      Aug 8 '14 at 0:02






    • 10





      The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

      – Anders
      Sep 22 '14 at 14:14






    • 18





      I have to google this every time... How can I help myself remember which is which?

      – Quentin Skousen
      Jan 22 '16 at 20:10






    • 11





      @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

      – pzkpfw
      May 1 '16 at 10:41













    363












    363








    363








    useradd is native binary compiled with the system. But, adduser is
    a perl script which uses useradd binary in back-end.



    adduser is more user friendly and interactive than its back-end
    useradd. There's no difference in features provided.




    Source: What's the difference between “adduser” and “useradd”?






    share|improve this answer
















    useradd is native binary compiled with the system. But, adduser is
    a perl script which uses useradd binary in back-end.



    adduser is more user friendly and interactive than its back-end
    useradd. There's no difference in features provided.




    Source: What's the difference between “adduser” and “useradd”?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 20 '17 at 10:04









    Community

    1




    1










    answered Sep 15 '13 at 20:56









    Radu RădeanuRadu Rădeanu

    120k35253328




    120k35253328







    • 54





      add useradd command wont create '/home/username' directory but adduser command will

      – Deepen
      Apr 30 '14 at 16:12







    • 56





      useradd with the -m option will create the home directory.

      – richsinn
      Aug 8 '14 at 0:02






    • 10





      The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

      – Anders
      Sep 22 '14 at 14:14






    • 18





      I have to google this every time... How can I help myself remember which is which?

      – Quentin Skousen
      Jan 22 '16 at 20:10






    • 11





      @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

      – pzkpfw
      May 1 '16 at 10:41












    • 54





      add useradd command wont create '/home/username' directory but adduser command will

      – Deepen
      Apr 30 '14 at 16:12







    • 56





      useradd with the -m option will create the home directory.

      – richsinn
      Aug 8 '14 at 0:02






    • 10





      The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

      – Anders
      Sep 22 '14 at 14:14






    • 18





      I have to google this every time... How can I help myself remember which is which?

      – Quentin Skousen
      Jan 22 '16 at 20:10






    • 11





      @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

      – pzkpfw
      May 1 '16 at 10:41







    54




    54





    add useradd command wont create '/home/username' directory but adduser command will

    – Deepen
    Apr 30 '14 at 16:12






    add useradd command wont create '/home/username' directory but adduser command will

    – Deepen
    Apr 30 '14 at 16:12





    56




    56





    useradd with the -m option will create the home directory.

    – richsinn
    Aug 8 '14 at 0:02





    useradd with the -m option will create the home directory.

    – richsinn
    Aug 8 '14 at 0:02




    10




    10





    The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

    – Anders
    Sep 22 '14 at 14:14





    The implimentation isn't that interesting, the semantics are. Like adduser(8) is more userfriendly and creates and set up a user by default the way you expect. And useradd(8) only do what you ask, so do you want a home directory created, you have to tell it to create it for you.

    – Anders
    Sep 22 '14 at 14:14




    18




    18





    I have to google this every time... How can I help myself remember which is which?

    – Quentin Skousen
    Jan 22 '16 at 20:10





    I have to google this every time... How can I help myself remember which is which?

    – Quentin Skousen
    Jan 22 '16 at 20:10




    11




    11





    @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

    – pzkpfw
    May 1 '16 at 10:41





    @kkhugs to me "adduser" feels the most intuitive because it's a command that sounds like english, while the other does not, semantically. If you remember it as the "most intuitive" of the two, you can also try to remember it as the preferred/easier one.

    – pzkpfw
    May 1 '16 at 10:41













    143














    Always use adduser (and deluser when deleting users) when you're creating new users from the command line. (If you're writing a script, especially if you aim for portability, you might want to use the lowlevel utilities instead – and adduser/deluser might not be available on all distros, e.g. on SuSE.)



    The useradd, userdel and usermod commands are lowlevel utilities which are there for historical reasons, while adduser/deluser Do The Right Thing™. (I remember which to use by thinking that user* comes after adduser/deluser in the alphabet, and therefore is "worse".)



    According to the respective manpages (on Ubuntu 12.04 Precise Pangolin, i.e. a Debian derivative system).



    Manpage for adduser says:



    (Emphasis added.)




    adduser and addgroup add users and groups to the system according to command line
    options and configuration information in /etc/adduser.conf. They are friendlier
    front ends to the low level tools like useradd, groupadd and usermod programs
    ,
    by default choosing Debian policy conformant UID and GID values, creating a home
    directory with skeletal configuration, running a custom script, and other features.
    adduser and addgroup can be run in one of five modes:




    Manpage for useradd says:




    useradd is a low level utility for adding users. On Debian, administrators should
    usually use adduser(8) instead.




    See also: What's the difference between “adduser” and “useradd”? (on SuperUser)






    share|improve this answer




















    • 6





      I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

      – Mads Skjern
      Mar 13 '15 at 12:27






    • 21





      I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

      – Wernight
      Apr 15 '15 at 10:47







    • 2





      I tried adduser on openSUSE, and it's not there.(13.2)

      – cst1992
      May 24 '16 at 7:18






    • 1





      @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

      – zrajm
      May 24 '16 at 15:40






    • 1





      useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

      – answerSeeker
      Feb 10 '17 at 0:53















    143














    Always use adduser (and deluser when deleting users) when you're creating new users from the command line. (If you're writing a script, especially if you aim for portability, you might want to use the lowlevel utilities instead – and adduser/deluser might not be available on all distros, e.g. on SuSE.)



    The useradd, userdel and usermod commands are lowlevel utilities which are there for historical reasons, while adduser/deluser Do The Right Thing™. (I remember which to use by thinking that user* comes after adduser/deluser in the alphabet, and therefore is "worse".)



    According to the respective manpages (on Ubuntu 12.04 Precise Pangolin, i.e. a Debian derivative system).



    Manpage for adduser says:



    (Emphasis added.)




    adduser and addgroup add users and groups to the system according to command line
    options and configuration information in /etc/adduser.conf. They are friendlier
    front ends to the low level tools like useradd, groupadd and usermod programs
    ,
    by default choosing Debian policy conformant UID and GID values, creating a home
    directory with skeletal configuration, running a custom script, and other features.
    adduser and addgroup can be run in one of five modes:




    Manpage for useradd says:




    useradd is a low level utility for adding users. On Debian, administrators should
    usually use adduser(8) instead.




    See also: What's the difference between “adduser” and “useradd”? (on SuperUser)






    share|improve this answer




















    • 6





      I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

      – Mads Skjern
      Mar 13 '15 at 12:27






    • 21





      I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

      – Wernight
      Apr 15 '15 at 10:47







    • 2





      I tried adduser on openSUSE, and it's not there.(13.2)

      – cst1992
      May 24 '16 at 7:18






    • 1





      @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

      – zrajm
      May 24 '16 at 15:40






    • 1





      useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

      – answerSeeker
      Feb 10 '17 at 0:53













    143












    143








    143







    Always use adduser (and deluser when deleting users) when you're creating new users from the command line. (If you're writing a script, especially if you aim for portability, you might want to use the lowlevel utilities instead – and adduser/deluser might not be available on all distros, e.g. on SuSE.)



    The useradd, userdel and usermod commands are lowlevel utilities which are there for historical reasons, while adduser/deluser Do The Right Thing™. (I remember which to use by thinking that user* comes after adduser/deluser in the alphabet, and therefore is "worse".)



    According to the respective manpages (on Ubuntu 12.04 Precise Pangolin, i.e. a Debian derivative system).



    Manpage for adduser says:



    (Emphasis added.)




    adduser and addgroup add users and groups to the system according to command line
    options and configuration information in /etc/adduser.conf. They are friendlier
    front ends to the low level tools like useradd, groupadd and usermod programs
    ,
    by default choosing Debian policy conformant UID and GID values, creating a home
    directory with skeletal configuration, running a custom script, and other features.
    adduser and addgroup can be run in one of five modes:




    Manpage for useradd says:




    useradd is a low level utility for adding users. On Debian, administrators should
    usually use adduser(8) instead.




    See also: What's the difference between “adduser” and “useradd”? (on SuperUser)






    share|improve this answer















    Always use adduser (and deluser when deleting users) when you're creating new users from the command line. (If you're writing a script, especially if you aim for portability, you might want to use the lowlevel utilities instead – and adduser/deluser might not be available on all distros, e.g. on SuSE.)



    The useradd, userdel and usermod commands are lowlevel utilities which are there for historical reasons, while adduser/deluser Do The Right Thing™. (I remember which to use by thinking that user* comes after adduser/deluser in the alphabet, and therefore is "worse".)



    According to the respective manpages (on Ubuntu 12.04 Precise Pangolin, i.e. a Debian derivative system).



    Manpage for adduser says:



    (Emphasis added.)




    adduser and addgroup add users and groups to the system according to command line
    options and configuration information in /etc/adduser.conf. They are friendlier
    front ends to the low level tools like useradd, groupadd and usermod programs
    ,
    by default choosing Debian policy conformant UID and GID values, creating a home
    directory with skeletal configuration, running a custom script, and other features.
    adduser and addgroup can be run in one of five modes:




    Manpage for useradd says:




    useradd is a low level utility for adding users. On Debian, administrators should
    usually use adduser(8) instead.




    See also: What's the difference between “adduser” and “useradd”? (on SuperUser)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 20 '17 at 10:18









    Community

    1




    1










    answered Nov 24 '13 at 17:42









    zrajmzrajm

    1,82711015




    1,82711015







    • 6





      I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

      – Mads Skjern
      Mar 13 '15 at 12:27






    • 21





      I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

      – Wernight
      Apr 15 '15 at 10:47







    • 2





      I tried adduser on openSUSE, and it's not there.(13.2)

      – cst1992
      May 24 '16 at 7:18






    • 1





      @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

      – zrajm
      May 24 '16 at 15:40






    • 1





      useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

      – answerSeeker
      Feb 10 '17 at 0:53












    • 6





      I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

      – Mads Skjern
      Mar 13 '15 at 12:27






    • 21





      I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

      – Wernight
      Apr 15 '15 at 10:47







    • 2





      I tried adduser on openSUSE, and it's not there.(13.2)

      – cst1992
      May 24 '16 at 7:18






    • 1





      @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

      – zrajm
      May 24 '16 at 15:40






    • 1





      useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

      – answerSeeker
      Feb 10 '17 at 0:53







    6




    6





    I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

    – Mads Skjern
    Mar 13 '15 at 12:27





    I never can remember which one, so this is my stupid mnemonic if it helps anyone :) "user" rhymes with "loser", and "loser" comes last. Thus: adduser, deluser.

    – Mads Skjern
    Mar 13 '15 at 12:27




    21




    21





    I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

    – Wernight
    Apr 15 '15 at 10:47






    I actually disagree on "Always user adduser": For automated scripts I'd prefer useradd because it's always there, non-interactive, and not distro-specific.

    – Wernight
    Apr 15 '15 at 10:47





    2




    2





    I tried adduser on openSUSE, and it's not there.(13.2)

    – cst1992
    May 24 '16 at 7:18





    I tried adduser on openSUSE, and it's not there.(13.2)

    – cst1992
    May 24 '16 at 7:18




    1




    1





    @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

    – zrajm
    May 24 '16 at 15:40





    @cst1992 You're right, I've edited the answer to reflect this. Curiously enough, when I tried locate adduser on a SuSE 11 system at work I found that there was an adduser manpage, but no binary (and neither a deluser manpage nor a command).

    – zrajm
    May 24 '16 at 15:40




    1




    1





    useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

    – answerSeeker
    Feb 10 '17 at 0:53





    useradd is better if you're a true sys admin. Not being able to use adduser in an autonomous script is a real bummer.

    – answerSeeker
    Feb 10 '17 at 0:53











    16














    adduser: add user with full profile and info (pass, quota, permission, etc.)



    useradd: add user with his name only (if you want to add a temp user with only a name,other info not required)






    share|improve this answer




















    • 1





      +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

      – Ricalsin
      Aug 9 '14 at 2:38















    16














    adduser: add user with full profile and info (pass, quota, permission, etc.)



    useradd: add user with his name only (if you want to add a temp user with only a name,other info not required)






    share|improve this answer




















    • 1





      +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

      – Ricalsin
      Aug 9 '14 at 2:38













    16












    16








    16







    adduser: add user with full profile and info (pass, quota, permission, etc.)



    useradd: add user with his name only (if you want to add a temp user with only a name,other info not required)






    share|improve this answer















    adduser: add user with full profile and info (pass, quota, permission, etc.)



    useradd: add user with his name only (if you want to add a temp user with only a name,other info not required)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 16 '15 at 15:28









    warvariuc

    1,56531938




    1,56531938










    answered Jul 2 '14 at 11:00









    mandmmandm

    16112




    16112







    • 1





      +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

      – Ricalsin
      Aug 9 '14 at 2:38












    • 1





      +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

      – Ricalsin
      Aug 9 '14 at 2:38







    1




    1





    +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

    – Ricalsin
    Aug 9 '14 at 2:38





    +1 and Welcome! I up voted the person who was incapable of explaining their previous down vote. Keep it up! Good programmers always rise to the top - (and don't down vote without an explanation). :)

    – Ricalsin
    Aug 9 '14 at 2:38











    8














    Another couple of differences, that lead to specific scenarios where useradd might be preferable.




    1. In some newer distros, including Ubuntu 14.4, adduser will prompt for information such as password and "gecos" (data for the finger command). This means it can be less suitable for calling from a script (credit: already mentioned in a comment by Wernight).



      The prompts can be suppressed by passing null arguments:



      adduser --disabled-password --gecos "" USER


    2. useradd allows you to pass multiple additional groups to add a user to by means of the -G option. adduser seems to require that you call the command once for each group to add.






    share|improve this answer

























    • Doesn't work on ubuntu 16.04.

      – answerSeeker
      Feb 10 '17 at 0:55















    8














    Another couple of differences, that lead to specific scenarios where useradd might be preferable.




    1. In some newer distros, including Ubuntu 14.4, adduser will prompt for information such as password and "gecos" (data for the finger command). This means it can be less suitable for calling from a script (credit: already mentioned in a comment by Wernight).



      The prompts can be suppressed by passing null arguments:



      adduser --disabled-password --gecos "" USER


    2. useradd allows you to pass multiple additional groups to add a user to by means of the -G option. adduser seems to require that you call the command once for each group to add.






    share|improve this answer

























    • Doesn't work on ubuntu 16.04.

      – answerSeeker
      Feb 10 '17 at 0:55













    8












    8








    8







    Another couple of differences, that lead to specific scenarios where useradd might be preferable.




    1. In some newer distros, including Ubuntu 14.4, adduser will prompt for information such as password and "gecos" (data for the finger command). This means it can be less suitable for calling from a script (credit: already mentioned in a comment by Wernight).



      The prompts can be suppressed by passing null arguments:



      adduser --disabled-password --gecos "" USER


    2. useradd allows you to pass multiple additional groups to add a user to by means of the -G option. adduser seems to require that you call the command once for each group to add.






    share|improve this answer















    Another couple of differences, that lead to specific scenarios where useradd might be preferable.




    1. In some newer distros, including Ubuntu 14.4, adduser will prompt for information such as password and "gecos" (data for the finger command). This means it can be less suitable for calling from a script (credit: already mentioned in a comment by Wernight).



      The prompts can be suppressed by passing null arguments:



      adduser --disabled-password --gecos "" USER


    2. useradd allows you to pass multiple additional groups to add a user to by means of the -G option. adduser seems to require that you call the command once for each group to add.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 30 '15 at 7:14









    muru

    1




    1










    answered Sep 29 '15 at 21:38









    AdamSAdamS

    33137




    33137












    • Doesn't work on ubuntu 16.04.

      – answerSeeker
      Feb 10 '17 at 0:55

















    • Doesn't work on ubuntu 16.04.

      – answerSeeker
      Feb 10 '17 at 0:55
















    Doesn't work on ubuntu 16.04.

    – answerSeeker
    Feb 10 '17 at 0:55





    Doesn't work on ubuntu 16.04.

    – answerSeeker
    Feb 10 '17 at 0:55











    7














    adduser is friendlier in that it sets up the account's home folders and other settings (e.g. automatically loading system stats and notifications on login), whereas useradd just creates the user.






    share|improve this answer


















    • 1





      Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

      – ychaouche
      Feb 21 '18 at 11:38















    7














    adduser is friendlier in that it sets up the account's home folders and other settings (e.g. automatically loading system stats and notifications on login), whereas useradd just creates the user.






    share|improve this answer


















    • 1





      Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

      – ychaouche
      Feb 21 '18 at 11:38













    7












    7








    7







    adduser is friendlier in that it sets up the account's home folders and other settings (e.g. automatically loading system stats and notifications on login), whereas useradd just creates the user.






    share|improve this answer













    adduser is friendlier in that it sets up the account's home folders and other settings (e.g. automatically loading system stats and notifications on login), whereas useradd just creates the user.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 15 '13 at 21:05









    PaulPaul

    1,56841330




    1,56841330







    • 1





      Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

      – ychaouche
      Feb 21 '18 at 11:38












    • 1





      Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

      – ychaouche
      Feb 21 '18 at 11:38







    1




    1





    Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

    – ychaouche
    Feb 21 '18 at 11:38





    Wrong. useradd can create home directory with -m, set password with -p, create skeleton files with -k, and add user to group(s) with -G.

    – ychaouche
    Feb 21 '18 at 11:38











    3














    Basic difference is "adduser" will create home directory & add skeleton files to that directory where "useradd" wont create any home directory & skeleton files !



    adduser try :



    Adding user `try' ...
    Adding new group `try' (1001) ...
    Adding new user `try' (1001) with group `try' ...
    Creating home directory `/home/try' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for try
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] y


    useradd try1 :



    # ll /home/
    total 20
    drwxr-xr-x 5 root root 4096 Oct 26 15:52 ./
    drwxr-xr-x 22 root root 4096 Oct 26 15:47 ../
    drwx------ 8 ashishk ashishk 4096 Oct 26 15:50 ashishk/
    drwxr-xr-x 3 root root 4096 Oct 14 13:02 .ecryptfs/
    drwxr-xr-x 2 try try 4096 Oct 26 15:52 try/
    root@chef-workstation:/home/ashishk#





    share|improve this answer























    • Wrong. See previous comment

      – ychaouche
      Feb 21 '18 at 11:42















    3














    Basic difference is "adduser" will create home directory & add skeleton files to that directory where "useradd" wont create any home directory & skeleton files !



    adduser try :



    Adding user `try' ...
    Adding new group `try' (1001) ...
    Adding new user `try' (1001) with group `try' ...
    Creating home directory `/home/try' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for try
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] y


    useradd try1 :



    # ll /home/
    total 20
    drwxr-xr-x 5 root root 4096 Oct 26 15:52 ./
    drwxr-xr-x 22 root root 4096 Oct 26 15:47 ../
    drwx------ 8 ashishk ashishk 4096 Oct 26 15:50 ashishk/
    drwxr-xr-x 3 root root 4096 Oct 14 13:02 .ecryptfs/
    drwxr-xr-x 2 try try 4096 Oct 26 15:52 try/
    root@chef-workstation:/home/ashishk#





    share|improve this answer























    • Wrong. See previous comment

      – ychaouche
      Feb 21 '18 at 11:42













    3












    3








    3







    Basic difference is "adduser" will create home directory & add skeleton files to that directory where "useradd" wont create any home directory & skeleton files !



    adduser try :



    Adding user `try' ...
    Adding new group `try' (1001) ...
    Adding new user `try' (1001) with group `try' ...
    Creating home directory `/home/try' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for try
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] y


    useradd try1 :



    # ll /home/
    total 20
    drwxr-xr-x 5 root root 4096 Oct 26 15:52 ./
    drwxr-xr-x 22 root root 4096 Oct 26 15:47 ../
    drwx------ 8 ashishk ashishk 4096 Oct 26 15:50 ashishk/
    drwxr-xr-x 3 root root 4096 Oct 14 13:02 .ecryptfs/
    drwxr-xr-x 2 try try 4096 Oct 26 15:52 try/
    root@chef-workstation:/home/ashishk#





    share|improve this answer













    Basic difference is "adduser" will create home directory & add skeleton files to that directory where "useradd" wont create any home directory & skeleton files !



    adduser try :



    Adding user `try' ...
    Adding new group `try' (1001) ...
    Adding new user `try' (1001) with group `try' ...
    Creating home directory `/home/try' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for try
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] y


    useradd try1 :



    # ll /home/
    total 20
    drwxr-xr-x 5 root root 4096 Oct 26 15:52 ./
    drwxr-xr-x 22 root root 4096 Oct 26 15:47 ../
    drwx------ 8 ashishk ashishk 4096 Oct 26 15:50 ashishk/
    drwxr-xr-x 3 root root 4096 Oct 14 13:02 .ecryptfs/
    drwxr-xr-x 2 try try 4096 Oct 26 15:52 try/
    root@chef-workstation:/home/ashishk#






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Oct 26 '15 at 14:10









    Ashish KarpeAshish Karpe

    6892720




    6892720












    • Wrong. See previous comment

      – ychaouche
      Feb 21 '18 at 11:42

















    • Wrong. See previous comment

      – ychaouche
      Feb 21 '18 at 11:42
















    Wrong. See previous comment

    – ychaouche
    Feb 21 '18 at 11:42





    Wrong. See previous comment

    – ychaouche
    Feb 21 '18 at 11:42











    0














    I'll also point out that adduser does not always have the -M option and also does not respect the --system flag which specifically says:




    Note that useradd will not create a home directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You have to specify the -m options if you want a home directory for a system account to be created.




    If you're trying to create a system user without a home directory then use useradd --system -M.






    share|improve this answer








    New contributor




    blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0














      I'll also point out that adduser does not always have the -M option and also does not respect the --system flag which specifically says:




      Note that useradd will not create a home directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You have to specify the -m options if you want a home directory for a system account to be created.




      If you're trying to create a system user without a home directory then use useradd --system -M.






      share|improve this answer








      New contributor




      blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        0












        0








        0







        I'll also point out that adduser does not always have the -M option and also does not respect the --system flag which specifically says:




        Note that useradd will not create a home directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You have to specify the -m options if you want a home directory for a system account to be created.




        If you're trying to create a system user without a home directory then use useradd --system -M.






        share|improve this answer








        New contributor




        blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        I'll also point out that adduser does not always have the -M option and also does not respect the --system flag which specifically says:




        Note that useradd will not create a home directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You have to specify the -m options if you want a home directory for a system account to be created.




        If you're trying to create a system user without a home directory then use useradd --system -M.







        share|improve this answer








        New contributor




        blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 days ago









        blockloopblockloop

        1034




        1034




        New contributor




        blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        blockloop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f345974%2fwhat-is-the-difference-between-adduser-and-useradd%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?