Linux operating system security

The basic concept of account

User: By establishing users with different permissions in Linux, the system resources can be reasonably controlled and used, and it can help users build their own private space and better organize and manage their own files.
When creating a user, the system will operate the two files /etc/passwd /etc/shadow to change the contents of the file

Every running process on the system requires a specific user to run

└─# head -1 /etc/passwd
root:x:0:0:root:/root:/usr/bin/zsh
 

root: username

x: password placeholder

0: user uid

0: user gid

root: annotation information

/root: user home directory path

/usr/bin/bash: login shell

 └─# head -1 /etc/shadow
root:rzLl0:19459:0:99999:7:::

root: username

rz.....: user's password

19459: The time of the last password change, how many days have passed since 1970

0: the minimum number of days the password is used, 0 is unlimited

99999: the maximum number of days the password can be used, set it to 99999 and it will not expire

7: Before the password expires, the system will remind you to change the password 7 days before the password expires

  : After the password expires, the user will be prompted to change the user password 2 days after the password expires

  : account expiration time, since 1970 , the account can be used before this date, and it will be invalid after expiration

user id uid

user uid meaning
0 root user, the most privileged user
1-200 System user, running the program that comes with the system, created by default

201-999

系统用户,运行系统安装的程序,无需登录系统
1000+ 普通用户,可以正常登录系统,权限比较小,能执行的任务有限

用户的添加 

 

useradd
-u:指定要创建用户的UID,不允许冲突
-g:指定要创建用户默认组GID
-G:指定要创建用户附加组,逗号隔开可添加多个附加组
-d:指定要创建用户家里目录
-s:指定要创建用户的bash shell(默认/bin/bash)(/sbin/nologin不能登入)
-c:指定要创建用户的注释信息
-M:给创建的用户不创建家目录
-r:创建系统账户,默认家目录

用户信息的修改 

 usermod

-u 指定要修改用户的UID
-g 指定要修改用户基本组
-G 指定要修改用户附加组,使用逗号隔开多个附加组, 覆盖原有的附加组
-aG 追加(设置多个附加组时用)
-d 指定要修改用户家目录 -md 旧家搬新家 (把原来的环境变量也复制过去)
-s 指定要修改用户的bash shell (默认/bin/bash)(/sbin/nologin不能登入)
-c 指定要修改用户注释信息
-l 指定要修改用户的登陆名
-L 指定要锁定的用户
-U 指定要解锁的用户

 用户的删除

userdel

-r 删除用户同时删除它的家目录

Linux系统日志

依赖的服务:rsyslog(syslog)

/etc/init.d/rsyslog status

默认配置文件

/etc/syslog.conf
/etc/rsyslog.conf (centos 6以后)
默认路径:/var/log(/var/tmp)

默认只有root用户对日志文件有修改权限 

所有的系统应用都会在 /var/log 目录下创建日志文件,或创建子目录再创建日志文件

 

Guess you like

Origin blog.csdn.net/qq_53633989/article/details/130665684