Linux Advanced Users, Groups and Permissions Introduction

  
Let's take a look at the four files for users and groups.
/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
First, let's take a look at the /etc/passwd file.
This file is just for storing user information
[root@localhost ~]#
[root@localhost ~]# cat /etc/passwd |  Grep user1
user1:x:500:500::/home/user1:/bin/bash
[root@localhost ~]#
There are a total of seven fields in this column. The meaning of the bit.
User1 Username
X User's password bit (If there is no such X on this bit, it means that the user does not need a password to log in)
500 UID
500 GID
The fifth is the password Descriptive information, not here.
/home/user1 User's /home directory
/bin/bash User's shell
There is a special shell /sbin/nologin
If you change the user's shell to /sbin/Nologin, then the user can only log in to the service, but can't log in to the computer. Interactive login is not allowed.
Let's take a look at the /etc/shadow file.
This file is mainly used to save the user's password information and policies.
[root@localhost ~]#
[root@localhost ~]# cat /etc/shadow |  Grep user1
user1:$1$2WJEp9K7$h.NRfJsaEm8VMksBQHZm7.:14668:0:99999:7:::
[root@localhost ~]#
Now let’s take a look at the meaning of each field< Br> User1 Username
The second field is the password of the saved user. This password is encrypted by MD5.
If there is a ! in front of the password, it means the user is locked.
14668 The time when the password was last modified
Copyright © Windows knowledge All Rights Reserved