Sponsored Content
Full Discussion: Creating groups and users
Top Forums UNIX for Advanced & Expert Users Creating groups and users Post 302697393 by jlliagre on Thursday 6th of September 2012 05:25:42 PM
Old 09-06-2012
Code:
getent passwd username

and
Code:
getent group groupname

will tell you if the username and groupname are already used.

Replace username and groupname by their numeric id in the previous commands if you want to make sure you won't have id clash.
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

Users and groups

Hi, Is it possible that one user belongs to many groups, or the relation of user/group is 1/1?. Thanks Ramón (2 Replies)
Discussion started by: rsanz
2 Replies

2. Linux

listing users and groups

RH 7.2 I'm trying to list the users & groups on my machine. I found the lsuser & lsgroup commands but no associated man pages. I typed: lsuser I get --> Valid options are: -a So I typed: lsuser -a I get --> Valid options are: groups, home So I typed: lsuser -a groups I get -->... (2 Replies)
Discussion started by: jalburger
2 Replies

3. UNIX for Dummies Questions & Answers

users and groups

hi eveyone i've recently requested my unix admin to create a userid for 2 groups. He created the id and i can see it by grep "id" /etc/group. But when i login with that id into unix and try to cd that group it says permission denied. something like cd /groupname -- permission denied Can my admin... (1 Reply)
Discussion started by: sammet
1 Replies

4. UNIX for Dummies Questions & Answers

Finding out all users and their UNIX groups??

Is there a way to find out all users and the UNIX groups they belong to?? :) (3 Replies)
Discussion started by: Hangman2
3 Replies

5. Solaris

Defaults number of users and Groups

Hi All, I would like know how many of default number of users and groups are there in solaris-10... Regards Tirupathi Raju (2 Replies)
Discussion started by: tirupathiraju_t
2 Replies

6. Solaris

Removing users from groups

How do I remove a user from a group? I'm using the usermod command but its not working. I have a user "abc" who is a member of the groups root and other. I'm trying to remove him from the group "other" (using CLI) which is his secondary group but it's not working. How do I do this? Is there any... (11 Replies)
Discussion started by: the_red_dove
11 Replies

7. UNIX for Dummies Questions & Answers

List users and groups

Hi I am new to unix so hopefully someone can help. I need to list all the users I have in my unix enviroment (AIX) and the groups (primary and secondary) they belong to. Can anyone help? Many thanks in advance (2 Replies)
Discussion started by: m3y
2 Replies

8. Shell Programming and Scripting

users and groups /etc/group parsing

Hi, I have two little issues: 1) there is possible in sh to create a function who return a boolean value? 2)i have to verify if an user belongs to a group and i think it is needed to create a function which take two parameter and return a boolean value. in fact i have to parse /etc/group... (5 Replies)
Discussion started by: catalint
5 Replies

9. UNIX for Dummies Questions & Answers

Users in multiple groups?

Happy Thanksgiving Everyone!! I have a question about adding users to multiple groups. Thanks in advance Using Red Hat and here are the issues: Example: Users: Bob Mark Groups: SystemsAnalysts BusinessAnalysts If I am adding a user Bob to both groups (SystemsAnalysts and... (2 Replies)
Discussion started by: hansokl
2 Replies

10. HP-UX

Creating user groups that are persistent

Hi, I need to modify the user 'munfai' by adding it into groups bscs, oinstall, dba. I use this command as user root to add the user into the mentioned groups : # usermod -G bscs,oinstall,dba munfai I can thereafter see the id in the groups : # id munfai uid=258(munfai) gid=20(users)... (2 Replies)
Discussion started by: anaigini45
2 Replies
NEWUSERS(8)						    System Management Commands						       NEWUSERS(8)

NAME
newusers - update and create new users in batch SYNOPSIS
newusers [options new_users] DESCRIPTION
The newusers command reads a file of user name and clear-text password pairs and uses this information to update a group of existing users or to create new users. Each line is in the same format as the standard password file (see passwd(5)) with the exceptions explained below: pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell pw_name This is the name of the user. It can be the name of a new user or the name of an existing user (or an user created before by newusers). In case of an existing user, the user's information will be changed, otherwise a new user will be created. pw_passwd This field will be encrypted and used as the new value of the encrypted password. pw_uid This field is used to define the UID of the user. If the field is empty, an new (unused) UID will be defined automatically by newusers. If this field contains a number, this number will be used as the UID. If this field contains the name of an existing user (or the name of an user created before by newusers), the UID of the specified user will be used. If the UID of an existing user is changed, the files ownership of the user's file should be fixed manually. pw_gid This field is used to define the primary group ID for the user. If this field contains the name of an existing group (or a group created before by newusers), the GID of this group will be used as the primary group ID for the user. If this field is a number, this number will be used as the primary group ID of the user. If no groups exist with this GID, a new group will be created with this GID, and the name of the user. If this field is empty, a new group will be created with the name of the user and a GID will be automatically defined by newusers to be used as the primary group ID for the user and as the GID for the new group. If this field contains the name of a group which does not exist (and was not created earlier wbefore by newusers), a new group will be created with the specified name and a GID will be automatically defined by newusers to be used as the primary group ID for the user and Gs the ID for the new group. pw_gecos This field is copied in the GECOS field of the user. pw_dir This field is used to define the home directory of the user. If this field does not specify an existing directory, the specified directory is created, with ownership set to the user being created or updated and its primary group. If the home directory of an existing user is changed, newusers does not move or copy the content of the old directory to the new location. This should be done manually. pw_shell This field defines the shell of the user. No checks are performed on this field. newusers first tries to create or change all the specified users, and then write these changes to the user or group databases. If an error occurs (except in the final writes to the databases), no changes are committed to the databases. During this first pass, users are created with a locked password (and passwords are not changed for the users which are not created). A second pass is used to update the passwords using PAM. Failures to update a password are reported, but will not stop the other password updates. This command is intended to be used in a large system environment where many accounts are updated at a single time. OPTIONS
The options which apply to the newusers command are: -h, --help Display help message and exit. -r, --system Create a system account. System users will be created with no aging information in /etc/shadow, and their numeric identifiers are chosen in the SYS_UID_MIN-SYS_UID_MAX range, defined in login.defs, instead of UID_MIN-UID_MAX (and their GID counterparts for the creation of groups). CAVEATS
The input file must be protected since it contains unencrypted passwords. CONFIGURATION
The following configuration variables in /etc/login.defs change the behavior of this tool: GID_MAX (number), GID_MIN (number) Range of group IDs used for the creation of regular groups by useradd, groupadd, or newusers. MAX_MEMBERS_PER_GROUP (number) Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in /etc/group (with the same name, same password, and same GID). The default value is 0, meaning that there are no limits in the number of members in a group. This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure that lines for NIS groups are not larger than 1024 characters. If you need to enforce such limit, you can use 25. Note: split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless you really need it. PASS_MAX_DAYS (number) The maximum number of days a password may be used. If the password is older than this, a password change will be forced. If not specified, -1 will be assumed (which disables the restriction). PASS_MIN_DAYS (number) The minimum number of days allowed between password changes. Any password changes attempted sooner than this will be rejected. If not specified, -1 will be assumed (which disables the restriction). PASS_WARN_AGE (number) The number of days warning given before a password expires. A zero means warning is given only upon the day of expiration, a negative value means no warning is given. If not specified, no warning will be provided. SYS_GID_MAX (number), SYS_GID_MIN (number) Range of group IDs used for the creation of system groups by useradd, groupadd, or newusers. SYS_UID_MAX (number), SYS_UID_MIN (number) Range of user IDs used for the creation of system users by useradd or newusers. UID_MAX (number), UID_MIN (number) Range of user IDs used for the creation of regular users by useradd or newusers. UMASK (number) The file mode creation mask is initialized to this value. If not specified, the mask will be initialized to 022. useradd and newusers use this mask to set the mode of the home directory they create It is also used by pam_umask as the default umask value. FILES
/etc/passwd User account information. /etc/shadow Secure user account information. /etc/group Group account information. /etc/gshadow Secure group account information. /etc/login.defs Shadow password suite configuration. /etc/pam.d/newusers PAM configuration for newusers. SEE ALSO
login.defs(5), passwd(1), useradd(8). System Management Commands 06/24/2011 NEWUSERS(8)
All times are GMT -4. The time now is 03:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy