There are several people (about 10 people) logged in and using Linux machines.
When adding a new user, use the useradd
command.
Look at the following site and see
https://uxmilk.jp/8530
You can check the list of users with the following command:
$cat/etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...
nginx:x:498:499:nginx user:/var/cache/nginx:/sbin/nologin
However, users related to services such as nginx
and docker
are also displayed.
useradd
How do I find the users that I have added with the command (that corresponds to the real person)?
/home
I think I can solve this problem by looking for a user linked to the directory, but I didn't know if this was really correct, so I asked.
$cat/etc/passwd|grep/home
syslog:x:102:106::/home/syslog:/usr/sbin/nologin
alice: x:1000:1000:alice,,,,:/home/alice:/bin/bash
useradd(1)
-u, --uid UID
The numerical value of the user's ID. This value must be unique, unrequited the -o
option is used. The value must be non-negotiable. The default is to use the small ID value greater than equal to UID_MIN
-r, --system
System users will be created with no aging information in Therefore, you can check it as follows, but it is not perfect because you can create a regular user by specifying /etc/shadow
, and their numerical identifiers are selected in the SYS_UID_MIN-SYS_UID_MAX
range, defined in /etc/login.defs
, install of the UIDuid
other than UID_MIN
to UID_MAX
.$readuid_minuid_max<<$(awk'/^UID_/{print$2}'/etc/login.defs|xargs)
$ awk-F:-vmin=${uid_min}-vmax=${uid_max}'$3>=min&&$3<=max'/etc/passwd
© 2024 OneMinuteCode. All rights reserved.