官术网_书友最值得收藏!

Users and groups

The following subsection will cover the required Linux commands to manage user accounts and groups. To create a new user, use the useradd command; for example, useradd <user>.

Also, you are capable of adding more information about the new user, such as the related shell, the user directory, and expiration date:

useradd <user> -d </Directory>
useradd <user> -e <date>
useradd <user> -s <shell>

Every user must have a password, and in order to change the password, they need root access. To change a user password, use the passwd command, as follows:

passwd <user>
$ passwd
Changing password for user1
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

To remove a user, use the userdel command. For example, userdel -r <user>, where the -r option is added to delete the files of the selected user.

Using groups is a technique for managing Linux accounts. Organizing users into groups is a security measure, and an isolation approach. To list all the groups in a Linux system, show the group file in the /etc directory using the cat command.

As you can see from the screenshot, the group file contains all the groups in your Linux system. Just type cat /etc/group:

To create a new group, use the newgrp command newgrp <Group_Name>.

主站蜘蛛池模板: 双柏县| 建水县| 新龙县| 喀喇沁旗| 斗六市| 民和| 景泰县| 岗巴县| 晋江市| 绿春县| 洪江市| 清远市| 嘉荫县| 类乌齐县| 葫芦岛市| 牟定县| 克拉玛依市| 辉县市| 金华市| 高邑县| 元氏县| 华亭县| 龙游县| 新昌县| 迁西县| 龙口市| 荃湾区| 定远县| 思茅市| 淄博市| 凤山县| 漠河县| 阿拉善左旗| 盐亭县| 沁源县| 靖江市| 图木舒克市| 乐安县| 济南市| 安吉县| 苍山县|