1. 程式人生 > 實用技巧 >linux使用者及密碼相關

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是開啟狀態。