Sponsored Content
Full Discussion: Adduser or useradd
Top Forums UNIX for Dummies Questions & Answers Adduser or useradd Post 302845563 by Aia on Wednesday 21st of August 2013 09:55:17 PM
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:
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
useradd(8)						      System Manager's Manual							useradd(8)

NAME
useradd - create a new user account SYNOPSIS
useradd [-D binddn] [-P path] [-c comment] [-d homedir] [-e expire] [-f inactive] [-G group,...] [-g gid] [-m [-k skeldir]] [-o] [-p password] [-u uid] [-U umask] [-r] [-s shell] [--service service] [--help] [--usage] [-v] [--preferred-uid uid] account useradd --show-defaults useradd --save-defaults [-d homedir] [-e expire] [-f inactive] [-g gid] [-G group,...] [-k skeldir] [-U umask] [-s shell] DESCRIPTION
useradd creates a new user account using the default values from /etc/default/useradd and the specified on the command line. Depending on the command line options the new account will be added to the system files or LDAP database, the home directory will be created and the initial default files and directories will be copied. The account name must begin with an alphabetic character and the rest of the string should be from the POSIX portable character class ([A- Za-z_][A-Za-z0-9_-.]*[A-Za-z0-9_-.$]). OPTIONS
-c, --comment comment This option specifies the users finger information. -d, --home homedir This option specifies the users home directory. If not specified, the default from /etc/default/useradd is used. -e, --expire expire With this option the date when the account will be expired can be changed. expiredate has to be specified as number of days since January 1st, 1970. The date may also be expressed in the format YYYY-MM-DD. If not specified, the default from /etc/default/useradd is used. -f, --inactive inactive This option is used to set the number of days of inactivity after a password has expired before the account is locked. A user whose account is locked must contact the system administrator before being able to use the account again. A value of -1 disables this feature. If not specified, the default from /etc/default/useradd is used. -G, --groups group,... With this option a list of supplementary groups can be specified, which the user should become a member of. Each group is separated from the next one only by a comma, without whitespace. If not specified, the default from /etc/default/useradd is used. -g, --gid gid The group name or number of the user's main group. The group name or number must refer to an already existing group. If not speci- fied, the default from /etc/default/useradd is used. -k, --skel skeldir Specify an alternative skel directory. This option is only valid, if the home directory for the new user should be created, too. If not specified, the default from /etc/default/useradd or /etc/skel is used. -m, --create-home Create home directory for new user account. -o, --non-unique Allow duplicate (non-unique) User IDs. -p, --password password Encrypted password as returned by crypt(3) for the new account. The default is to disable the account. -U, --umask umask The permission mask is initialized to this value. It is used by useradd for creating new home directories. The default is taken from /etc/default/useradd. -u, --uid uid Force the new userid to be the given number. This value must be positive and unique. The default is to use the first free ID after the greatest used one. The range from which the user ID is chosen can be specified in /etc/login.defs. --preferred-uid uid Set the new userid to the specified value if possible. If that value is already in use the first free ID will be chosen as described above. -r, --system Create a system account. A system account is an user with an UID between SYSTEM_UID_MIN and SYSTEM_UID_MAX as defined in /etc/login.defs, if no UID is specified. The GROUPS entry in /etc/default/useradd is ignored, too. -s, --shell shell Specify user's login shell. The default for normal user accounts is taken from /etc/default/useradd, the default for system accounts is /bin/false. --service service Add the account to a special directory. The default is files, but ldap is also valid. -D, --binddn binddn Use the Distinguished Name binddn to bind to the LDAP directory. The user will be prompted for a password for simple authentica- tion. -P, --path path The passwd and shadow files are located below the specified directory path. useradd will use this files, not /etc/passwd and /etc/shadow. --help Print a list of valid options with a short description. --usage Print a short list of valid options. -v, --version Print the version number and exit. FILES
/etc/passwd - user account information /etc/shadow - shadow user account information /etc/group - group information /etc/default/useradd - default values for account creation /etc/skel - directory containing default files SEE ALSO
passwd(1), login.defs(5), passwd(5), shadow(5), userdel(8), usermod(8) AUTHOR
Thorsten Kukuk <kukuk@suse.de> pwdutils May 2010 useradd(8)
All times are GMT -4. The time now is 03:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy