linux用户及密码相关

linux用户相关

/etc/default/useradd       #linux添加用户的默认配置文件

/etc/login.defs        #linux用户登陆配置文件

/etc/skel          #用户目录架构相关的配置文件

Linux密码相关

启动linux,进入内核模式,按"e" --------》选择进入相应的内核,找到linux16所在的行,在行尾输入“rd.break“ --------》按”Ctrl+x“进入单用户模式 ---------》”mount -o  rw.remount /sysroot“重新挂载新根,赋予读写权限 -------》"chroot /sysroot",进入到新根 -------》”vim   /etc/passwd“ 修改用户登陆shell信息,”passwd  root“修改账号登陆密码 --------》”touch  /.autorelabel“,创建.autorelabel文件,因为selinux开启的原因,需要用到,否则无法启动,会出现卡进度条的现象。出现卡进度条现象时,可以按键盘F5键,查看启动状态信息。按esc键,显示进度条读取的进度。

[root@x112 ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28
[root@x112 ~]# getenforce 
Enforcing
[root@x112 ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=disabled
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

selinux在linux7单用户模式,一直显示为disabled,但是/etc/selinux/config中的配置只要是enforcing,重启生效,就代表selinux是开启状态。

原文地址:https://www.cnblogs.com/xiaofeng666/p/12182121.html