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 realize user Management in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces Linux how to achieve user management, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

0x01 / etc/skel

The skel directory is a directory used to store new user configuration files. When a new user is added, all files in this directory will be automatically copied to the new user's home directory. You can initialize environment variables for new users and add unified files by modifying the files in the skel directory.

Let's add a file to this directory and modify the profile file to verify it

Then create a new user to authenticate

0x02 / etc/login.defs

The login.defs file is used to define some user configuration information needed to create a user, whether a home directory is required, UID, GID scope, and so on.

You can see the validity period of the password and the setting values of the range of UID and GID

0x03 / etc/default/useradd

The / etc/default/useradd file is a default configuration file that is called when adding a user using useradd, and the contents can be modified using the "useradd-D parameter"

We can see that the newly created users are all / bin/sh

They are all controlled from here.

0x04 useradd

When we use useradd to add users, the system will first read the parameters in the configuration files / etc/login.defs and / etc/default/useradd, then add them according to the rules, and add the corresponding records in the / etc/passwd and / etc/group files

Check the parameter commands of useradd by yourself. Here is an example to illustrate.

Add user wuxin, set user comment information to balabala, specify UID to 800, belong to user group root and test,shell type / bin/sh, home directory is wuxinhome

0x05 passwd

You can use passwd to change your password, but you can learn about the other parameters it has.

With the help of these parameters, we can achieve the requirement that the user wuxin cannot change the password within 7 days, must change the password after 60 days, notify 7 days before expiration, and forbid login 10 days after expiration.

0x06 a bunch of orders.

Just get to know it.

W and who

Display the current user login situation

Last

Displays the history of the user's login, which looks at the / var/log/wtmp file

Lastlog

Displays the recent login of all computing users, which looks at / var/log/lastlog

0x07 sudo Foundation

The configuration information for sudo operation is / etc/sudoers. If you need to modify it, you usually use visudo, because this command comes with syntax checking.

Note: there is no sudo in Debian series by default.

You can also view specific configuration information using the-l parameter

Thank you for reading this article carefully. I hope the article "how to achieve user Management in Linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Internet Technology

Wechat

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

12
Report