Wubantu group management and user management

Source: Internet
Author: User

Wubantu group management and user management
I. Group Management

To add or delete a group or change a group, sudo is required to use the root identity for execution.

PS (/etc is the directory dedicated to saving system configuration information/etc/group to save group information)

Ii. User Management1. create user/set password/delete user sudo

Useradd-m-g group new username add new user-m automatically create user home directory if you forget to add-m recommended to delete the user, then recreate

-G: Specifies the user's group. A group with the same name is created.

Passwd user name set user password if it is a common user, you can directly use passwd to change your account password

Userdel-r user name delete user-r option will automatically delete the user's home directory

Cat/etc/passwd | grep user name confirm user information after creating a user, the user information will be saved in the/etc/passwd file

2. View user information

Id [user name] If no parameter is added, the current user can view UID and GID information by default.

Who to view the list of all currently logged on users

Whoami

Usermod command

Usermod can be used to set the user's main group/additional group and logon shell

# Modify the usermod-g username of the user's main group (GID In passwd) # modify the usermod-G username of the user's additional group # modify the usermod-s/bin/bash username of the user's logon Shellusermod-s/bash

PS: by default, users who use useradd are not authorized to use sudo to execute commands as root. You can use the following command to add users to The sudo additional group to log on again to take effect.

Usermod-G sudo Username

Shell is the window where terminal commands can be entered.

3. Switch users
  • Su-Change User Name and switch directory-you can switch to the user's home directory; otherwise, the location remains unchanged.
    • The difference is that the green account addition has changed, that is, the home directory has changed.
  • Exit to exit the current Logon account

Su is not connected to the user name. You can switch to root, but it is not recommended because it is not safe.

Exit is as follows:

4. Modify file permissions

Chmod chown chgrp

# Modify file | directory owner chown user name | directory name # recursively Modify file | directory group chgrp-R group name file name | directory name # recursively modify File Permission chmod-R 755 file name | directory name
When chmod sets the permission, you can simply use three numbers to correspond to the permissions of the owner/group and other users respectively.

  • Chmod can modify user/group permissions on files/directories, but cannot be precise to Owner | group | Other
  • Chmod +/-rwx file name | directory name

 

For the difference between bin/sbin and the which command, view the two passwd blog posts:

Http://www.cnblogs.com/lzhh/p/ubuntu_7.html

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.