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

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>.

主站蜘蛛池模板: 加查县| 湘潭县| 丰镇市| 山阳县| 格尔木市| 厦门市| 五河县| 安图县| 大渡口区| 法库县| 虹口区| 东至县| 靖江市| 南平市| 郯城县| 郯城县| 陆河县| 建始县| 商水县| 济阳县| 双鸭山市| 西乌珠穆沁旗| 林周县| 从化市| 田东县| 苏州市| 永昌县| 洞头县| 宾川县| 怀宁县| 乌什县| 尼玛县| 盖州市| 彭泽县| 长宁县| 泰兴市| 驻马店市| 鸡东县| 宝坻区| 达孜县| 阿拉尔市|