Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to manage Ubuntu users and groups

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to manage Ubuntu users and groups. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

users and groups

Ubuntu defaults to a single user, but if your PC is used by more than one user, *** creates a user account for each user. This allows each user to have their own settings and profiles, and also ensures that their files are not seen by other users.

Generally speaking, Linux computers have two accounts, one is the user himself and the other is the root account. The root account is the super account, which can manage all the resources and settings on the computer and manage other users. Ubuntu is somewhat different in this regard. It logs in to the root account by default, but this account can be upgraded to root by sudo command.

Linux accounts store all account information in a file under the path '/etc/groups'. You can view and edit users and groups in the system by running commands on the terminal, such as:

sudo vigr /etc/groups

establish an account

To create an account, you need to click System-> Administration-> Users and Groups, and then click the Add button to add a new user.

Creating a user

As shown below, give your account a name and check the "Encrypt" checkbox to encrypt your home folder.

Click "Advanced Settings" to set user permissions

The permissions of user Anna are listed in the User Rights tab of Advanced Settings, as shown in the following figure:

Here we recommend removing the "admin" privileges of other users. This way, other users won't change important system settings and destroy your computer.

Linux file and folder permissions

Every file in Linux has user and group permissions. You can run ls -l on the terminal to see the full permissions and attributes.

The LS -L command is used to view

From left to right, each item corresponds to the following:

▲ 1

For example, on the image viewed by ls-l command, there is a file called anki, permission is rwxr-xr-x(there are special explanations for each meaning later), the file is owned by root user, belongs to root group, and the size is 159 bytes.

Among them, the *** partial permission has four components, *** characters are identification, indicating whether it is a file or a folder--folder is represented by "d", and general files are represented by "-". The last nine characters are grouped into three groups, representing user, group, and individual permissions.

In this example, the permissions are rwxr-xr-x, respectively:

RWX means:

·r = read permission

w = write permission

· x = executable permissions

So everyone has read and execute privileges but only root has write privileges.

Change the group to which files and folders belong

Scenario: Anna is in seventh grade and her brother Peter is taking a programming course at college. Anna is more interested in using educational software to do math and geography homework, while her brother prefers software open tools.

We can set Anna's and Peter's permissions for these applications in the Admin Group:

We create two groups, K-12, University, and assign users to each group.

We should give the K-12 group permission to run educational software.

Linux places most executable software in/usr/bin, such as Anki(an educational software bar) in/usr/bin/anki. If you don't know where the file is located, you can use the "which command in the terminal to find it:

Now change Kig to k12 group using the following command:

You can also revoke read and execute permissions from other groups using chmod:

This will allow the K12 community to use Anki and Kig software. I should remove the read and execute permissions of the university group for Anki and Kig software from the "others" group. Use the following command:

The above *** command removes read and execute permissions from the Others group. The "O" parameter refers to an operation on the "Others" group. The "-" parameter is to cancel the corresponding permission after "-." Detailed usage of this command can be viewed with the ***:"man" command

Limit computer usage

Timekpr is a software that allows us to set the usage time of each user's computer. You need to add the following PPA to the software source before installing this software from the Ubuntu Software Center.

Add software source is also very simple, open the terminal, in turn, enter the following commands on ok.

Ubuntu Software Center is the most convenient installation Timekpr-search under there

Timekpr can set the computer usage time for each day of the month. For example, it can be set to 300 minutes on weekdays and 60 minutes on Mondays.

Timekpr will appear in the task bar at the top and lock the computer when the time is up

About "how to manage Ubuntu users and groups" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report