Linux user and group management commands

Source: Internet
Author: User

Linux user and Group management commands details Linux system manages user and Group configuration and management commands in Group mode mainly include: user management commands useradd new user usermod modify user userdel delete user newusers new user (Batch) passwd Change User Password chsh set user's shellchage Set User Password validity period newgrp add user to a group id print user id and group idwho print current Login User whoami print current user name and id command details as follows (from the command manual): useraddNAME name useradd-create a new user or update default new user informationSYNOPSIS usage useradd [options] LOGIN useradd-D [options] DESCRIPTION Overview When invoked without the-D option, the useradd command creates a new user account using the values specified on the command line plus the default values from the system. depending on command line options, the useradd command will update system files and may also create the new user's home directory and copy initial files. by default, a group will also be created for the new user (see-g,-N,-U, And USERGROUPS_ENAB ). usermodNAME usermod-modify a user accountSYNOPSIS usermod [options] LOGINDESCRIPTION The usermod command modifies the system account files to reflect the changes that are specified on the command line. userdelNAME userdel-delete a user account and related filesSYNOPSIS userdel [options] LOGINDESCRIPTION The userdel command modifies the system account files, deleting all Entries that refer to the user name LOGIN. the named user must exist. newusersNAME newusers-update and create new users in batchSYNOPSIS 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 existing users or to create new users. each line is in the same format as the standard password f Ile (see passwd (5) with the specified tions 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. passwdNAME passwd-update user's Uthentication tokensSYNOPSIS passwd [-k] [-l] [-u [-f] [-d] [-n mindays] [-x maxdays] [-w warndays] [- I inactivedays] [-S] [-- stdin] [username] DESCRIPTION The passwd utility is used to update user's authentication token (s ). this task is achieved through cballs to the Linux-PAM and Libuser API. essen-tially, it initializes itself as a "passwd" service with Linux-PAM and utilizes configured passwor D modules to authenticate and then update a user's password. chshNAME chsh-change your login shellSYNOPSIS chsh [-s shell] [-l] [-u] [-v] [username] DESCRIPTION chsh is used to change your login shell. if a shell is not given on the command line, chsh prompts for one. valid shells chsh will accept the full pathname of any executable file on the system. however, it will issue a warning if the shel L is not listed in the/etc/shells file. on the other hand, it can also be configured such that it will only accept shells listed in this file, unless you are root. chageNAME chage-change user password expiry informationSYNOPSIS chage [options] [LOGIN] DESCRIPTION The chage command changes the number of days between password changes and the date of the last password change. this information is us Ed by the system to determine when a user must change his/her password. newkgname newgrp-log in to a new groupSYNOPSIS newgrp [-] [group] DESCRIPTION The newgrp command is used to change the current group ID during a login session. if the optional-flag is given, the user's environment will be reinitialized as though the user had logged in, otherwise the current environment, including current w Orking directory, remains unchanged. newgrp changes the current real group ID to the named group, or to the default group listed in/etc/passwd if no group name is given. newgrp also tries to add the group to the user groupset. if not root, the user will be prompted for a password if she does not have a password (in/etc/shadow if this user has an entry in the shadowed password file, or in/etc/pa Sswd otherwise) and the group does, or if the user is not listed as a member and the group has a password. the user will be denied access if the group password is empty and the user is not listed as a member. if there is an entry for this group in/etc/gshadow, then the list of members and the password of this group will be taken from this file, otherwise, the entry in/etc/group is considered. id NAME id-print real and valid tive user and group IDsSYNOPSIS id [OPTION]... [USERNAME] DESCRIPTION Print user and group information for the specified USERNAME, or (when USERNAME omitted) for the current user. without any OPTION, print some useful set of identified information. AUTHOR Written by Arnold Robbins and David macenzie. whoNAME who-show who is logged onSYNOPSIS who [OPTION]... [FILE | ARG1 ARG2] DESCRIPTION Print information about users who are currently logged in. whoamideappsprint the user name associated with the current valid user ID. same as id-un. group Management groupadd new group groupmod modify group groupdel Delete group groups print current user group gpasswd set group password groupaddNAME groupadd-create a new groupSYNOPSIS groupadd [options] groupDESCRIPTION The groupadd command creates a new group account using Values specified on the command line plus the default values from the system. the new group will be entered into the system files as needed. groupmodNAME groupmod-modify a group definition on the systemSYNOPSIS groupmod [options] GROUPDESCRIPTION The groupmod command modifies the definition of the specified GROUP by modifying the appropriate entry in the group database. groupdelNAME groupdel-d Elete a groupSYNOPSIS groupdel groupDESCRIPTION The groupdel command modifies the system account files, deleting all entries that refer to group. the named group must exist. groupsNAME groups-print the groups a user is inSYNOPSIS groups [OPTION]... [USERNAME]... DESCRIPTION Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if Groups database has changed ). gpasswdNAME gpasswd-administer/etc/group and/etc/gshadowSYNOPSIS gpasswd [option] groupDESCRIPTION The gpasswd command is used to administer/etc/group, and/etc/gshadow. every group can have administrators, members and a password. system administrators can use the-A option to define group administrator (s) and the-M option to define members. they have all rights Of group administrators and members. gpasswd called by a group administrator with a group name only prompts for the new password of the group. if a password is set the members can still use newgrp (1) without a password, and non-members must supply the password. notes about group passwords Group passwords are an inherent security problem since more than one person is permitted to know the password. However, groups are a useful tool for permitting co-operation between different users. related command chmod set file Permission chown set file ownerchgrp set file group owner chmodNAME chmod-change file mode bitsSYNOPSIS chmod [OPTION]... MODE [, MODE]... FILE... chmod [OPTION]... OCTAL-mode file... chmod [OPTION]... -- reference = rfile file... DESCRIPTION This manual page documents ents the GNU version of chmod. chmod changes the file Mode bits of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pat-tern for the new mode bits. chownNAME chown-change file owner and groupSYNOPSIS chown [OPTION]... [OWNER] [: [GROUP] FILE... chown [OPTION]... -- reference = rfile file... DESCRIPTION This manual page documents ents the GNU version of chown. chown Changes the user and/or group ownership of each given file. if only an owner (a user name or numeric user ID) is given, that user is made the owner of each given file, and the files 'group is not changed. if the owner is followed by a colon and a group name (or numeric group ID), with no spaces between them, the group ownership of the files is changed as well. if a colon but no group name follows The user name, that user is made the owner of the files and the group of the files is changed to that user's login group. if the colon and group are given, but the owner is omitted, only the group of the files is changed; in this case, chown performs the same function as chgrp. if only a colon is given, or if the entire operand is empty, neither the owner nor the group is changed. chkgname chgrp -Change group ownershipSYNOPSIS chgrp [OPTION]... group file... chgrp [OPTION]... -- reference = rfile file... DESCRIPTION Change the group of each FILE to GROUP. with -- reference, change the group of each FILE to that of RFILE. the preceding commands are commonly used for user and group management. You can use the man command to view the parameters, usage, and details of these commands.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.