首页 > 编程知识 正文

秘密复杂写法,linux查看log命令

时间:2023-05-06 09:48:10 阅读:195252 作者:262

我们都知道linux下有很多用户,有超级管理员用户,有普通用户,还有很多的系统用户。

那么问题来了,这些用户是怎样产生的呢?又是那些规则决定着这些用户的属性呢?那么,就让我带你们走进linux,揭开它的神秘面纱吧!

凡是接触过linux的人都知道,创建一个用户只需要很简单的一个命令:“useradd +用户名”就能成功创建一个linux普通用户,“passwd +用户名”就可以给用户设定密码。

[root@tomcatClient ~]# useradd liupengfang

[root@tomcatClient ~]# passwd liupengfang

更改用户 liupengfang 的密码 。

新的 密码:

重新输入新的 密码:

passwd: 所有的身份验证令牌已经成功更新。

创建完成后,我们可以用id命令查看该用户的ID:

[root@tomcatClient ~]# id liupengfang

uid=4005(liupengfang) gid=4005(liupengfang) 组=4005(liupengfang)

还可以在/home目录下查看到该用户的家目录:

[root@tomcatClient ~]# cd /home/

[root@tomcatClient home]# ls

fedora  Fedora  liupengfang  mandriva

我们会看到用户liupengfang的uid为4005,gid也为4005.为什么这些id不是从1开始呢?为什么在创建该用户后会在/home目录下创建一个自己的家目录呢?这些用户会不会过期呢?这就需要我们了解一个文件------login.defs。

我们查看下这个文件:

[root@tomcatClient home]# vim /etc/login.defs

PASS_MAX_DAYS   99999    #密码最长过期时间

PASS_MIN_DAYS   0        #密码最短过期时间

PASS_MIN_LEN    5        #密码最小长度

PASS_WARN_AGE   7        #密码过期提前提醒时间

#

# Min/max values for automatic uid selection in useradd

#

UID_MIN                   500    #uid最小值

UID_MAX                 60000    #uid最大值

#

# Min/max values for automatic gid selection in groupadd

#

GID_MIN                   500    #gid最小值

GID_MAX                 60000    #gid最小值

#

# If defined, this command is run when removing a user.

# It should remove any at/cron/print jobs etc. owned by

# the user to be removed (passed as the first argument).

#

#USERDEL_CMD    /usr/sbin/userdel_local

#

# If useradd should create home directories for users by default

# On RH systems, we do. This option is overridden with the -m flag o

n

# useradd command line.

#

CREATE_HOME     yes    #是否同时建立家目录

# The permission mask is initialized to this value. If not specified

,

# the permission mask will be initialized to 022.

UMASK           077    #创建后用户的权限掩码

# This enables userdel to remove user groups if no members exist.

#

USERGROUPS_ENAB yes    #创建用户时是否同时创建相同用户名的组

# Use SHA512 to encrypt password.

ENCRYPT_METHOD SHA512    #密码加密方式为SHA512

看完这个配置文件,我们就会大致了解,为什么用户创建后它的那些属性其实都是有根有据的,login.defs这个文件就是用来设置用户创建时属性的文件。当然这些属性也不是固定不变的,我们可以用usermod +参数来改变它的各个属性,而这些参数只要man一下就知道了。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。