Linux Create user Group directive

Source: Internet
Author: User

useradd (option)
-c< Remarks: Add notes text. Note text is saved in the comment field of passwd;
-d< login Directory;: Specify the starting directory for user login;
-D: Change the preset value;
-e< validity period;: Specify the expiry date of the account;
-f< buffer days;: Specify how many days after the password expires to close the account;
-g< Group;: Specify the group to which the user belongs;
-g< Group;: Specifies the additional group to which the user belongs;
-M: Automatically set up the user's log in directory;
-M: Do not automatically set up the user's log in directory;
-N: Cancels the creation of a group named after the user name;
-R: Establish the system account number;
-S: Specifies the shell to use when the user is logged in;
-U: Specifies the user ID.

When setting the ID value, try to be greater than 500 to avoid conflicts. Because Linux installation will create some special users, generally 0 to 499 of the value between the bin, mail, such as the system account

[Email protected] ~]# useradd-c/etc/passwd-d/home/tom-g root-g alice-s/bin/csh Tom
Example: TOM:X:500:0:/ETC/PASSWD:/HOME/TOM:/BIN/CSH
Comments:
Tom User name: x password, password: 500 user ID (0 for root, normal new user starting from 500): 0 Group:/etc/passwd Description:/home/tom User home directory:/BIN/CSH user preset shell

passwd (option)
-D: Remove the password, only the System Manager can use;
-F: Enforcement;
-K: Settings can only be updated after expiration of the password expires;
-L: Lock the password;
-S: Lists information about the password, only the System Manager can use;
-U: Unlock the locked account.

Set Tom password passwd Tom returns two times
Password complexity rules: (normal user)
1. Use at least 3 kinds of 4 kinds of characters wrongly written characters
2, long enough, greater than 7 bits
3. Using Random strings
4. Regular replacement
5, the cycle period is large enough
Switch to Tom next su Tom
Su:switch User
Full switch #su-l user Name
#su user name Half switch


For example: tom:$6$ism36.j3e0pyqduc5mwmawg.5nep8erybk9lqu.:17095:0:99999:7:7:17095:
Tom User Name
$6$ism36.j3e0pyqduc5mwmawg.5nep8erybk9lqu.$ Password to be encrypted
17095 creation date and number of days apart today
0 Minimum password number of digits
99999 User Password
7-7-Day Reminder
7 Disabled days
17095 Expiration Days
For example, we let a user cannot change the password, you can use the-l option to lock

[[email protected] ~]# passwd-d linuxde//clear Linuxde user password
[[email protected] ~]# passwd-s linuxde//query linuxde user password status;
Note: When we clear a user's password, we do not need a password when we log in.

Exit: Quit Tom User
Userdel Tom: Delete Tom users without deleting their home directories and files
Userdel-r: Delete the user and delete all files related to the user
Userdel-f: Force Delete user, even if user is currently logged in
Please do not easily use the-r option; He will delete the user all the files and directories, remember that if there are important files in the user directory, please back up before deleting


Groupadd (option)
-G: Specifies the ID of the new workgroup;
-r: Create system Workgroup, System Workgroup Group ID is less than 500;
-K: Overwrite configuration file "/ect/login.defs";
-O: Allows you to add a workgroup with a group ID number that is not unique.


-c< notes;: Modify the note text of the user account,
-d< Login directory, modify the user login directory,
-e< validity period,: Modify the validity period of the account;
-f< buffer days; Modify the number of days after the password expires to close the account,
-g< Group;: Modify the group to which the user belongs;
-g< Group;: Modify the additional group to which the user belongs;
-l< account name;: Modify user account name;
-L: Lock the user's password to invalidate the password;
-S: Modify the shell used by the user after logging in;
-u: Modify the user ID;
-u: Unlock the password.

groupmod command to change the group identifier or name. When you need to change the identification code or name of the group, you can use the GROUPMOD directive to do this.
Groupmod (option)
-g< Group identification Code;: Set the group identifier to use;
-O: Repeat the group identifier;
-n< new group name;: Set the name of the group you want to use.

PWCK command is used to verify the integrity of the contents and format of the system authentication file/etc/passwd and/etc/shadow.


The SU command toggles the current user identity to another user's identity
SU (option)
-c< directive > or--command=< instruction;: After executing the specified instructions, the original identity will be restored;
-F or--fast: For CSH and Tsch, so that the shell does not have to read the boot file;
-L or--login: changes the working directory as well as home,shell,user,logname when changing identities. In addition, the path variable is changed;
-m,-p or--preserve-environment: Do not change the environment variables when changing identities;
-S or--shell=: Specifies the shell to execute;
--help: Display Help;
--version; displays version information.

Linux Create user Group directive

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.