Linux full-stack directory of cloud computing (section 6 user management, group account management, scheduled tasks)

Three stages of learning Linux must go through

1.ADMIN (cloud computing system management)
2.ENGINEER (cloud computing application management)
3.SERVICES (system, service management advanced)


Read more if you are ugly! –Tuge



One.ADMIN (Cloud Computing System Management)

1. Basics of cloud computing network
2. Introduction to Linux installation, basic operation
3. Command line basis, directory and file management, text content operation
4. Archive compression, redirection, pipeline, find precise search, vim advanced application
5. RPM software Package management, yum package warehouse, command supplement
6. User management, group account management, scheduled tasks

Two.ENAINEER (Cloud Computing Application Management)

1. Basic permissions and ownership, additional permissions, ACL policy management
2. Disk space management, swap space
3. Logical volume management, RAID disk array, process management, VDO
4. Configure LInux network, source code compilation and installation, custom yum warehouse, Log management
5. SElinux system fault repair, firewall policy management, service management

Three.SERVICES (Advanced System Service Management)

1. Kvm construction and management, virsh control tool, image management, virtual machine quick construction technology
2. Web basic application, NFS service foundation, trigger mount, summary and answering
3. DNS service foundation, special resolution, DNS subdomain authorization, DNS master-slave architecture, summary and Q&A
4. Cached DNS, Split separation analysis, email communication, Web server project combat, summary and Q&A
5. Batch installation environment, configuration of PXE boot, kickstart automatic response, Cobbler installation platform, summary and Q&A
6.rsync synchronization operation, inotify real-time synchronization, database service foundation, management table data, summary and Q&A

6. User management, group account management, scheduled tasks

Account-based access control

Account type

1. User account

The identification method is: UID
Super user root UID: 0
System user UID: 1-999
Common user UID: 1000 or more

A user belongs to at least one group

2. Group account

Used to distinguish permissions from logging in

The identification method is: GID

Group accounts are divided into: basic group and private group.
Basic group: created by the system, with the same name as the user (usually not used).
Private group: created by the administrator, with a different name from the user (commonly used)

Account is stored in local account

User account
/etc/passwd (basic information)
/etc/shadow (password information)

Group account
/etc/group (basic information)
/etc/gshadow (password information)

/etc/passwd 七个字段(用户账号的基本信息)
head -1 /etc/passwd
root:x:0:0:root:/root:/bin/bash
账号名称:密码字串和占位符:UID:GID:用户全名:家目录:解释器(登录shell程序的路径)

/etc/shadow 九个字段(用户账号的密码信息)
head -1 /etc/shadow
root:$67Q:15908:0:99999:7:::
名称:加密后的密码字符串:上次修改的时间:密码最短有效天数(自1970.1.1到上一次修改时间的天数):密码最长有效天数:密码过期前的警告天数:过期多少天禁用此账号:账号失效时间:保留字段(未使用)

/etc/group 四个字段(组账号的基本信息)
group stugrp
grep stugrp /str/group
stugrp:x:1005:
名称:密码占位符:GID:本组的成员列表

/etc/gshadow 四个字段(组账号的密码信息)
stugrp:!::
名称:加密后的字串:本组管理员列表(可以属于这个组,也可以不属于):成员用户列表

user account

useradd
-u: Specify UID tag number
-d: Specify home directory
-G: Specify additional group to belong to
-s: Specify user's login interpreter Example: Forbid users to log in to the system (/sbin/nologin)

useradd -d /opt/stu01/ /stu01
id stu01(查询账号id)
useradd -G users stu01
指定stu01用户的附加组是users
ls -ld /opt/stu01

usermod (modified)
-l: change the new and old user account name
-u: user id
-d: home directory path (the directory will not be rebuilt)
-s: login interpreter
-G: additional group (reset)

passwd --stdin

echo 123 | passwd stu01(非交互式,常用)
passwd stu01(交互式)

useradd delete -r (delete all)

useradd -r zengye

su-stu01 (temporary switch user) exit: return to root

Group account

Add group account

groupadd -g(GID) name

grep stu01 /etc/group(查询)
stu01:x:1005:

gpasswd (management group members)
-A: define the list of group administrators
-a: add group members, add one each time
-d: delete group members, delete one each time
-M: define the list of group members, multiple

gpasswd -M a,b,c stu01
grep stu01 /etc/gshadow
stu01:!:stu01:a,b,c
(用户加入组,重启终端或exit)

groupdel delete group groupadel stu01

useradd -G adminuser natasha natasha user is a subordinate group of adminuser

gpasswd -A "" stu01 gpasswd -M "" stu01 Define the list of group administrators to be empty Define the list of group members to be empty

Scheduled Tasks

Configure a cron task log file /var/log/cron
crontab
-e edit -u username*: any time
-l view -u username/: separate multiple discrete points in time
-r clear -u username/n : Specify time frequency

配置:
	systemctl restart crond
	systemctl enable crond
	crontab -e -u natasha
	23 14 * * * /bin/echo hiya


检查:
	date -s '14:22:50'
	等10秒
	tail /var/log/cron
	......成功
分 时 日 月 周
30 23 *  *  *      每晚11:30执行一次
30 23      1-5/1,5 周一到周五每晚23:30执行一次/周一和周五每晚11:30执行一次 

Permanently modify alias

vim /etc/bashrc (global, only allow administrators to modify)
vim /root/.bashrc (under root user) restart the terminal or source
/root./bashrc can also
1. Write in whose home directory and who takes effect
2. Use Take effect globally

supplement

root# gpasswd -A tuge1 Tuge
root# su -tuge1
tuge1# gpasswd -a natasha Tuge (添加组成员)
tuge1# gpasswd -d natasha Tuge (删除组成员)
root# gpass -A " Tuge 删除管理员

Tell the important thing three times

As a coder who has dedicated his life to Linux, I am very honored and proud. Here I have summarized some of the essence of Linux, that is, a quick article, which will be updated later, I hope you will pay attention to it. It is absolutely useful!

Guess you like

Origin blog.csdn.net/weixin_43051805/article/details/108754289