Visit Our UNIX and Linux User Community


Adduser or useradd


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Adduser or useradd
# 1  
Old 08-21-2013
Adduser or useradd

I am just wondering why there are two similar commands for creating a user. Could you please point me when I should choose adduser and when useradd? This puzzles me a little.

Thanks,
Panos
# 2  
Old 08-21-2013
They're the same command, or should be:

Code:
[root@ns1 ~]# ll $(which useradd)
-rwxr-x---. 1 root root 103096 Dec  7  2011 /usr/sbin/useradd
[root@ns1 ~]# ll $(which adduser)
lrwxrwxrwx. 1 root root 7 Jan 26  2013 /usr/sbin/adduser -> useradd

This User Gave Thanks to Scott For This Post:
# 3  
Old 08-21-2013
The command to create an account in Linux, at the command line is useradd.
This is the command you are expected to know if you go to pass CompTIA Linux+, LPIC 101 or RHCSA certification.

In some systems it can have more or less "automatic" parameters entered for you using some defaults: like it may or may not create a home for the user, automatically, if you do not provide those parameters.
useradd -D shows the defaults. Some files that it uses for configuration support are /etc/default/useradd and /etc/skel/

On the other hand, adduser is more of a prompted, interactive command, where you are asked for settings if you don't enter it initially. It is a different binary in distros like Ubuntu. However, in distros like Redhat, it is just a link to useradd, so those feature do not exist.
This User Gave Thanks to Aia For This Post:
# 4  
Old 08-22-2013
Thanks very much Smilie

PS: What Linux distro do you suggest me to use in order to prepare for my LPI exams ?
# 5  
Old 08-22-2013
LPI claims to be "vendor neutral", so it shouldn't matter.
This User Gave Thanks to Scott For This Post:
# 6  
Old 08-22-2013
Quote:
Originally Posted by Zeldforged
PS: What Linux distro do you suggest me to use in order to prepare for my LPI exams ?
If you do not have LPI 101 already, I recommend CompTIA Linux+ since, at this time, it has a partnership with LPI, which if you pass CompTIA LX0-101 and LX0-102 you will be passing the certification as well for LPI 101 and 102 and you can ask them for both certifications.

In any case, these certifications are vendor neutral, which means you do have to know quite a bit about many things Linux.
For instance, instead of having to know, only, rpm and and yum as in Redhat; with LPI you'll need to know dpkg, and apt-get, as well.

Therefore, you'll need a distribution based in Debian and a distribution based in Redhat, for better results.

RHCSA and RHCE are the next step. Theses exams are real hands on, and there is no multiple choice questions. For these you must configure whatever they ask you in a virtual machine, and the killer is that you must know things very well, including Selinux, because the time allow will be your enemy.
This User Gave Thanks to Aia For This Post:
# 7  
Old 08-23-2013
Thanks again guys, you've been extra helpful Smilie
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #271
Difficulty: Easy
While working at Bletchley Park, in the first week of June each year Alan Turing would get a bad attack of hay fever, and he would cycle to the office wearing a service gas mask to keep from breathing pollen. In the first week of June each year he would get a bad attack of hay fever, and he would cycle to the office wearing a service gas mask to keep from breathing the pollen.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Adduser

hi, when i want to "adduser newuser" i receved this warning : event type "audit_buf" is a fixed event and may not be manipulated help me please (2 Replies)
Discussion started by: rezasadeghi
2 Replies

2. Solaris

Solaris 10 adduser

Brain teaser, I was given the task below. I believe the consultant runs software on his laptop that probes our QA tier web servers for xxx The two web servers are xxx I attempt useradd command on XXX which seems to work, but when I attempt to assign a pwd, the OS denies it and says user... (1 Reply)
Discussion started by: yellow_mustard
1 Replies

3. Red Hat

Adduser -> Access denied

hi, I have a problem with any user i created on a linux server RH. With the user root i did: adduser toto passwd toto (to give it a password - message : "all authentication tokens updated successfully") I can do a "su - toto", but when I try to connect it directly by ssh i have the message... (3 Replies)
Discussion started by: Castelior
3 Replies

4. Shell Programming and Scripting

How to automate adduser on FreeBSD?

After just posting a query on beginners@perl.org inquiring about the perl API for automating useradd/userdel/usermod on FreeBSD, I got to thinking: Maybe perl is not the best approach to automating useradd/usermod/userdel. We have a list of users from a windows system and we want to run a... (5 Replies)
Discussion started by: siegfried
5 Replies

5. Shell Programming and Scripting

exec a build command (adduser) in a script

Hi, With a awk script i create a "adduser line" $ cat /tmp/tmp.ldif | awk -f ldif2adduser.awk adduser --uid 1002 --gid 1000 --gecos "ROUSSIN Guy" --home /homeL/guy --shell /bin/bash --disabled-password guy If i cut and paste this line, all is fine. But in a shell script i get errors : ... (2 Replies)
Discussion started by: guyr
2 Replies

6. Shell Programming and Scripting

shell script for nessus-adduser

I took a stab at writing a script to automate the interactive process of adding users to Nessus - I have zero previous coding experience. So far, it doesn't get me anywhere. I took small sections of code from posts I found on this site and others:... (1 Reply)
Discussion started by: nolamiami
1 Replies

7. UNIX for Advanced & Expert Users

useradd?

Hi Experts, when using useradd command, what are the necessary options/arguments to be included? Please advice. (4 Replies)
Discussion started by: etcpasswd
4 Replies

8. Shell Programming and Scripting

useradd

Gurus, I need to add a user to all the machines. I need a script to do this. I did one but it does not allow me to su to root within a ssh session i open. It exists saying su: Sorry. Please let me know how i can do it. I do not have the freedom of using sudo either. Regards (4 Replies)
Discussion started by: earlysame55
4 Replies

9. Programming

adduser

Hi, Let me know any urls where i can get the source code for "adduser" program.. Please help.. esham (1 Reply)
Discussion started by: esham
1 Replies

10. Shell Programming and Scripting

question related to command "adduser"

Hello.. I dont know if i can ask this question in this session..if wrong please correct me.. This is my question.. When iam creating a user with command " adduser xxx" Where are the changes happening.. I know in /etc/passwd , /etc/shadow... in /home Is there any i missed.. please... (1 Reply)
Discussion started by: esham
1 Replies

Featured Tech Videos