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

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

主站蜘蛛池模板: 太白县| 凤山市| 镇雄县| 辽宁省| 长宁县| 鲁甸县| 云梦县| 叙永县| 璧山县| 类乌齐县| 武冈市| 吴桥县| 钟祥市| 安塞县| 启东市| 宿迁市| 永平县| 灵寿县| 安达市| 青神县| 三门县| 会昌县| 竹溪县| 宜州市| 鞍山市| 富川| 讷河市| 甘南县| 清苑县| 安图县| 巴彦县| 疏勒县| 达孜县| 金川县| 罗源县| 朔州市| 洛隆县| 壤塘县| 逊克县| 深泽县| 扶沟县|