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 view files related to users in CentOS

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

Share

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

CentOS how to view files related to users, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

1. View user-related files command:

1.cat

2.more

3.head / etc/passwd

# View the first ten lines of the file

4.head-2 / etc/passwd # View the first two lines of the file

5.tail / etc/passwd

# View the last ten lines of the file

6.tail-f / etc/passwd # the last ten lines of the real-time trace file

6.tail-2 / etc/passwd # View the last two lines of the file

7.wc-l / etc/passwd

# display the number of lines in the file

8.nl / etc/passwd

# print the contents of the file directly and display the line number

Root:X:0:0:root:/root: / bin/bash

User name: the user name should not be too long. Niejunzhong

-"njz

X: password bit reserved, previous linux storage password

Uid

Identifier of the user

Gid

Default group identification number

The system creates a group with the same name by default

Description information

Annotative description

Host directory

The default directory after the user logs in

Command interpreter

Shell default bash used by the user

Password file shadow

Etc/passwd every user has read permission. The earlier password was placed in the password bit.

Man-5 shadow

Login name: encrypted password: last modified time: minimum time interval: maximum time interval: warning time: account idle time: expiration time: flag.

Time: 1969 Ken. Thomas developed the prototype of unix. The industry believes that linux was born on January 1, 1970.

The superuser does not have write permission by default and can still be modified or deleted.

Root

Pwconv password writeback password is first written to passwd and then converted to shadow

Passwd command

Ls-l

/ usr/bin/passwd

Why can ordinary users change their passwords?

Definition of SetUID: when an executable program has SetUID privileges, the user executes the program as the owner of the program.

The owner of Passwd is root. All ordinary users become root owners when they change their passwords to execute this command.

Modify user profile to add user (principle)

Username

/ etc/passwd

Password

/ etc/shadow

1. Vi / etc/passwd username password uid gid describes the host directory shell

2. Mkdir creates the host directory and gives permission to the user directory

Chown

3 、 Vi / etc/shadow

You can log in to a different command prompt at this time

4. Cd / etc/skel is full of hidden files ls-a

5. Transfer the files in Cp skel to the host directory of the new user

User profile / etc/

Login.defs configure maximum time interval for mail minimum time interval (root is not limited) automatically create directory Umask

Whether the Etc/default/useradd host directory default directory account is disabled, account expiration time

Login information

Before login: etc/issue avoids exposing system version information

After logging in: / etc/motd

Inside information

Wall broadcast

User category:

There are three types of Linux users

Superuser root

Uid=0

Ordinary user

Uid 500-60000

Pseudo user:

Uid 1-499

A user with a Uid of 0 is called superuser, in front of the command prompt

[] #

Ls

Pseudo user

1. Pseudo users are related to system and program services.

Bin, baemon, shutdown, halt, etc. Any linux system has these pseudo-users by default

Mail, news, games, apache, ftp, mysql and sshd are related to the process of linux system.

2. Pseudo users usually do not need or cannot log in to the system.

3. There can be no host directory.

Second, user management:

1. New user

Useradd user1

two。 Delete user

Userdel-r user1

3. Modify the password

1) passwd user1

2) echo 123 | passwd-- stdin user1

4. View users

Id user1

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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