Difference between useradd and adduser commands
Solved
Guiwald
-
Linux -
Linux -
Hello,
I would like to know the difference between the "adduser" and "useradd" commands in Linux.
Thank you for your answers.
I would like to know the difference between the "adduser" and "useradd" commands in Linux.
Thank you for your answers.
13 réponses
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
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
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,
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,
[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"
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?
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?
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 :)
@++
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"
Hello.
Same as "asevere"
@+
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! ;-)
Hi asevere.
Under "Suse 8.1," the "useradd" gives the same result, but the "adduser" is unknown to the "bash."
@+
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! ;-)
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
http://doc.ubuntu-fr.org/adduser#creer_un_compte_ou_un_groupe_d_utilisateurs_de_maniere_non-interactive
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.
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