diff --git "a/52\351\231\206\345\207\257/2024-06-14 \347\224\250\346\210\267\345\222\214\347\224\250\346\210\267\347\273\204\347\256\241\347\220\206.md" "b/52\351\231\206\345\207\257/2024-06-14 \347\224\250\346\210\267\345\222\214\347\224\250\346\210\267\347\273\204\347\256\241\347\220\206.md" new file mode 100644 index 0000000000000000000000000000000000000000..39c504f1d655ef51766d9e012d0e7099d106eae1 --- /dev/null +++ "b/52\351\231\206\345\207\257/2024-06-14 \347\224\250\346\210\267\345\222\214\347\224\250\346\210\267\347\273\204\347\256\241\347\220\206.md" @@ -0,0 +1,102 @@ +### + +创建/guanli 目录,在/guanli下创建zonghe 和 jishu 两个目录(一条命令) + +root@hecs-235925:~# mkdir -p /guanli/zonghe &&mkdir /guanli/jishu +添加组帐号zonghe、caiwu、jishu,GID号分别设置为2001、2002、2003 + +root@hecs-235925:~# groupadd -g 2001 zonghe +root@hecs-235925:~# groupadd -g 2002 caiwu +root@hecs-235925:~# groupadd -g 2003 jishu +创建jerry、kylin、tsengia、obama用户,其中的kylin用户帐号在2020年12月30日后失效 + +root@hecs-235925:~# useradd jerry && useradd -e 2020-12-30 kylin && useradd tsengia && useradd obama +将jerry、kylin、tsengia、obama等用户添加到zonghe组内 + +root@hecs-235925:~# gpasswd -M jerry,kylin,tsengia,obama zonghe +创建handy、cucci用户,其中cucci帐号的登录Shell设置为“/sbin/nologin” + +root@hecs-235925:~# useradd handy && useradd cucci +root@hecs-235925:~# usermod -s /sbin/nologin cucci +将handy、cucci等用户添加到jishu组内 + +root@hecs-235925:~# gpasswd -M handy,cucci jishu +将上述的所有用户均要求加入到guanli组内 + +root@hecs-235925:~# groupadd guanli +root@hecs-235925:~# gpasswd -M jerry,kylin,tsengia,obama,handy,cucci guanli +将zonghe组内的obama用户删除 + +root@hecs-235925:~# gpasswd -d obama zonghe +Removing user obama from group zonghe +为jerry用户设置密码为“123456”(使用普通方法)为cucci用户设置密码为“redhat” + +root@hecs-235925:~# passwd jerry +root@hecs-235925:~# passwd redhat +将jerry用户锁定,并查看锁定状态 + +root@hecs-235925:~# usermod -L jerry +root@hecs-235925:~# passwd -S jerry +jerry L 06/14/2024 0 99999 7 -1 +打开两个xshell窗口,通过(who 或者 w)命令查看连接状态,并通过fuser杀掉其中一个 + +zdy18@hecs-235925:~$ sudo apt-get update +zdy18@hecs-235925:~$ sudo apt-get install psmisc +zdy18@hecs-235925:~$ who +zdy18@hecs-235925:~$ fuser -k/dev/pts/1 +查看cucci用户,属于那些组,并查看其详细信息 + +root@hecs-235925:~# groups cucci +zdy18@hecs-235925:~$ sudo apt-get install finger +zdy18@hecs-235925:~$ finger cucci +手工创建账号student(预留) + +root@hecs-235925:~# vi /etc/passwd +student:x:1014:1014::/home/student:/bin/bash +root@hecs-235925:~# vi /etc/shadow +student::18107:0:99999:7::: +root@hecs-235925:~# vi /etc/group +student:x:1014: +root@hecs-235925:~# mkdir /home/student +root@hecs-235925:~# cd /etc/skel/ +root@hecs-235925:~skel# ls -a | cp .b* /home/student/ +设置权限及归属:/guanli目录属组设为guanli, /guanli/zonghe目录的属组设为zonghe /guanli/jishu目录的属组设为jishu,设置3个目录都是禁止其他用户访问的权限 + +root@hecs-235925:~# chown :guanli /guanli +root@hecs-235925:~# chown :zonghe /guanli/zonghe +root@hecs-235925:~# chown :jishu /guanli/jishu +root@hecs-235925:~# chmod -R o-rwx /guanli/ +建立公共目录/ceshi允许技术组内的所有用户读取、写入、执行文件, 禁止其他用户读、写、执行 + +root@hecs-235925:~# mkdir /ceshi +root@hecs-235925:~# chown .jishu /ceshi/ +root@hecs-235925:~# chmod 770 /ceshi/ +root@hecs-235925:~# ls -ld /ceshi +drwxrwx--- 2 root jishu 4096 Jun 14 19:12 /ceshi +清除jerry用户密码 + +root@hecs-235925:~# passwd -d jerry +passwd: password expiry information changed. +锁定cucci用户密码并查看状态 + +root@hecs-235925:~# passwd -l cucci +passwd: password expiry information changed. +root@hecs-235925:~# passwd -S cucci +cucci L 06/14/2024 0 99999 7 -1 +修改obama用户的UID为8888 + +root@hecs-235925:~# id obama +uid=1021(obama) gid=1021(obama) groups=1021(obama),2004(guanli) +root@hecs-235925:~# usermod -u 8888 obama +root@hecs-235925:~# id obama +uid=8888(obama) gid=1021(obama) groups=1021(obama),2004(guanli) +通过passwd命令修改kylin用户的最长密码使用期限为60天 + +root@hecs-235925:~# passwd -x 60 kylin +passwd: password expiry information changed. +root@hecs-235925:~# cat /etc/shadow |grep "kylin" +kylin:!:19888:0:60:7::18626: +通过id groups等命令查看用户handy信息 + +root@hecs-235925:~# id handy +uid=1022(handy) gid=1022(handy) groups=1022(handy),2003(jishu),2004(guanli) \ No newline at end of file diff --git "a/52\351\231\206\345\207\257/2024-06-17 \345\221\250\346\234\237\344\273\273\345\212\241\347\273\203\344\271\240.md" "b/52\351\231\206\345\207\257/2024-06-17 \345\221\250\346\234\237\344\273\273\345\212\241\347\273\203\344\271\240.md" new file mode 100644 index 0000000000000000000000000000000000000000..a58b6735e8fdd435e386ef80d1d0847cd8d73e60 --- /dev/null +++ "b/52\351\231\206\345\207\257/2024-06-17 \345\221\250\346\234\237\344\273\273\345\212\241\347\273\203\344\271\240.md" @@ -0,0 +1,65 @@ +### 周期任务练习 + +执行在家目录touch a.txt + +每天3:00执行一次 + +0 3 * * * +每周六2:00执行 + +0 2 * * 6 +每周六1:05执行 + +05 1 * * 6 +每周六1:25执行 + +25 1 * * 6 +每天8:40执行 + +40 8 * * * +每天3:50执行 + +50 3 * * * +每周一到周五的3:40执行 + +40 3 * * 1-5 +每周一到周五的3:41开始,每10分钟执行一次 + +41/10 3 * * 1-5 +每天的10:31开始,每2小时执行一次 + +31 10/2 * * * +每周一到周三的9:30执行一次 + +30 9 * * 1-3 +每周一到周五的8:00,每周一到周五的9:00执行一次 + +0 8,9 * * 1-5 +每天的23:45分执行一次 + +45 23 * * * +每周三的23:45分执行一次 + +45 23 * * 3 +每周一到周五的9:25到11:35、13:00到15:00之间,每隔10分钟执行一次 + +25,35,45,55 9 * * 1-5 +5,15,25,35,45,55 10 * * 1-5 +5,15,25,35 11 * * 1-5 +*/10 13-15 * * 1-5 +每周一到周五的8:30、8:50、9:30、10:00、10:30、11:00、11:30、13:30、14:00、14:30、5:00分别执行一次 + +30 8,9,10,11,13,14 * * 1-5 +50 8 * * 1-5 +0 10,11,14,5 * * 1-5 +每天16:00、10:00执行一次 + +0 16,10 * * * +每天8:10、16:00、21:00分别执行一次 + +10 8 * * * +0 16,21 * * * +每天7:47、8:00分别执行一次 + +47 7 * * * +0 8 * * * \ No newline at end of file