Linux Create delete users and user groups

Source: Internet
Author: User

1, Useradd-- Create user

Simple to create a normal user (of course, you have to do it under root login)

useradd username - p password


tail

When you create a new user, you alsounder etc directoryof thepasswd fileTo add information about this new user in thewhen we create a successful user, vim /etc/passwd can see the user you just created at the bottom , or you canUsetail-3 etc/passwd command to display only the last 3 lines of the file.


3, Userdel-- Delete the user

Userdel username


4, create a normal user to a senior administrator

First look at the meaning of the user fields in passwd, such as root:

Root:x:0:0:root:/root:/bin/bash

In the middle with ":" Split, the corresponding meaning is:

User name: Password: uid:gid: Description: Home directory: Login using Shell.


In the/etc/passwd file we can take a look at root uid and gid what is it? We can see r , then we can Strong style= "Background-color:inherit;" , then you have root privileges.


6. su--Switching users

If there are multiple users, the SU command is available under the command-line window to switch to each other:
su User name
Description: SU is an abbreviation for switch user, which indicates a switchover.

enter "Exit" from the new user state to return to the user status you just made.

7. Add and delete user groups:

Groupadd testgroup -- Adding a user group

Groupdel testgroup --Deletion of user groups


8, VIM,tail-- View the new user group created

the Add and delete information for the group will be the group file for the ETC directory embodied in it. Use vim /etc/group and tail-3 /etc/group to view


9, Rm-rf testuser -- Delete the directory where the user testuser

After the user is created, the user's home directory is generated at//and the user's home directory can be deleted using rm-rf testuser If you want to delete the user.

This article is from the "Chi Mas" blog, please be sure to keep this source http://gpool.blog.51cto.com/1137393/1602661

Linux Create delete users and user groups

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.