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

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

主站蜘蛛池模板: 乡宁县| 牙克石市| 庆元县| 修武县| 台前县| 井陉县| 凤台县| 张家口市| 乌海市| 岗巴县| 天峨县| 达州市| 上犹县| 呼和浩特市| 手机| 志丹县| 定南县| 元氏县| 潢川县| 永和县| 曲阜市| 侯马市| 桂阳县| 锡林浩特市| 资兴市| 孟村| 婺源县| 遂平县| 会东县| 安顺市| 金山区| 泰来县| 平武县| 屯门区| 肥乡县| 上虞市| 阜阳市| 都昌县| 乐昌市| 保靖县| 桂林市|