Linux command--useradd

Source: Internet
Author: User

  1. Command format:

    useradd [option] User name (option not writable)

  2. Command function:

    Create a new user

  3. Common options:

    - u Specifies the user ID, but requires that the UID is not used by another user when specified

    - d Specify user account host Directory

    - e Specify user account expiration time, date format: YYYY-MM-DD

    - g Specifies the user's base group (you can use the GID number to represent the group name)

    - g Additional groups for the specified user (you can use the GID number to represent the group name)

    - M does not establish a user host directory

    - s login shell for the specified user

  4. Common examples:

    Example one: Creating a user Zhangsan

    Command: useradd Zhangsan

    Note: If you do not add an option, by default, a host directory named after a user name is created in the directory, and a user's initial configuration file is created in that directory, a basic group named after the user name and joined to the group, the system will be/etc/passwd and/etc/ Shadow add the user account record at the end of the two files and log in to the shell for/bin/bash

    Example two: Create an account named Lisi, and specify a base group of wheel, the host directory is/lisi

    Command: useradd-d /lisi-g wheel Lisi

    Note: When specifying a group, the group must exist in the system


    Example three: Create a user named Wangwu, request to disable login system, do not create the host directory, and the account expires on December 31, 2016

    Command: useradd-m-S /sbin/nologin- e 2016-12-31 Wangwu

This article is from the "Shiyu" blog, make sure to keep this source http://928004321.blog.51cto.com/10707688/1731421

Linux command--useradd

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.