Linux View all users and view user groups (modify user groups) _linux shell

Source: Internet
Author: User

1. View all users in Linux

(1) in the terminal. In fact, only need to view the/etc/passwd file on the line.
(2) Look at the third parameter: More than 500, is built behind the user. Others are users of the system.

or use cat/etc/passwd |cut-f 1-d:

2, User Management command

Useradd Note: Add user
AddUser Note: Add user
passwd Note: Set password for user
Usermod Note: Modify the user command, you can modify the login by Usermod, user's home directory and so on;
Pwcov Note: Sync user from/etc/passwd to/etc/shadow
PWCK Note: Pwck is the validation of user profile/etc/passwd and/etc/shadow file content is legal or complete;
Pwunconv Note: Pwcov is the reverse operation, from/etc/shadow and/etc/passwd to create/etc/passwd, and then delete/etc/shadow files;
Finger Note: View user Information tool
ID Note: View the user's UID, GID, and the user group they belong to
CHFN Note: Change the user Information tool
SU Note: User Switching tool
sudo note: sudo executes commands through another user (execute a command as another user), Su is used to toggle the user, and then through the switch to the user to complete the corresponding task, but sudo can directly follow the command, such as Sudo Root can be executed without root password only root can execute the corresponding command, but it has to be visudo to edit the/etc/sudoers to achieve;
Visudo Note: Visodo is the editor of the/etc/sudoers command, you can not use this command, directly with VI to edit the/etc/sudoers effect is the same;
Sudoedit Note: Similar to the sudo function;

3, the management of user groups (group) of tools or orders;

Groupadd Note: Add user group;
Groupdel Note: delete user group;
Groupmod Note: Modify user group information
Groups Note: Displays the user group to which the user belongs
Grpck
GRPCONV Note: Synchronizes or creates/etc/gshadow through the contents of/etc/group and/etc/gshadow files, if/etc/gshadow does not exist;
Grpunconv Note: Synchronize or create/etc/group through/etc/group and/etc/gshadow file contents, and then delete gshadow files

First create the user group test and the FTP home directory

Copy Code code as follows:

Groupadd Test

Mkdir/tmp/test

Then create the user

Copy Code code as follows:

Useradd-g test–d/tmp/test–m USR1

Note: G: User's Group D: Indicates the location of the user's own directory to give the specified

M: Do not create a default home directory, which means that there is no directory under/home

Copy Code code as follows:

Useradd–g test–d/tmp/test–m USR2
[Code]

Then change the owner and permissions of the folder

Chown usr1.test/tmp/test--This means that the owner of the/tmp/test is designated as USR1

chmod 750/tmp/test--7 says WRX 5 means that Rx 0 means no permissions.

The purpose of this experiment is to USR1 have permission to upload, delete and download.

and USR2 only has permission to download and not to upload and delete

Of course, don't forget our main configuration file vsftpd.conf


Modify a user's password or add a user password

Take user name as an example, add User: Useradd name, set Password: passwd name, and then, according to the prompts, enter the password two times.

Delete User: Userdel name, in fact, has not been completely deleted, only the user can not login, the directory of the files are still in the reservation.

Such as:
[Code]
Useradd username

passwd username

Userdel username

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.