1, the Replication/etc/skel directory is/home/tuser1, requires/home/tuser1 and its internal files belong to the group and other users do not have any access rights.
[[email protected] ~]# cp -r /etc/skel /home[[email protected] ~]# mv /home/skel /home/tuser1[[email protected] ~]# chmod g-r,o-r /home/tuser1[[email protected] ~]# ll -a /home/ |grep tuser1drwx--x--x. 2 root root 59 7 Month 4 15:12 tuser1[[email protected] ~]# chmod g-r,o-r Total dosage of /home/tuser1/.*[[email protected] ~]# ll -a /home/tuser1 16drwx--x--x. 2 root root 59 7 Month 4 15:12 . d-wx--x--x. 10 root root 4096 7 month 4 15:13 .. -RW-------. 1 root root 18 7 month 4 15:12 . BASH_LOGOUT-RW-------.   1 ROOT&NBSp;root 193 7 Moon    4 15:12 .BASH_PROFILE-RW-------. 1 Root root 231 7 Month    4 15:12 .BASHRC
2. Edit/etc/group file, add group Hadoop
[Email protected] ~]# vi/etc/grouphadoop:x:3500: #最后一行输入
3, the manual/etc/passwd file adds a row, add user Hadoop, its basic group ID is the Hadoop group ID number; its home directory is/home/hadoop.
[Email protected] ~]# Vi/etc/passwdhadoop:x:3500:3500::/home/hadoop:/bin/bash
4. Copy the/etc/skel directory as/home/hadoop, which requires that the genus Group and other users of the Hadoop directory be modified without any access rights.
[Email protected] ~]# cp-r/etc/skel/home[[email protected] ~]# mv/home/skel/home/hadoop[[email protected] ~]# chmod g -r,o-r/home/hadoop[[email protected] ~]# ll/home |grep hadoopdrwx--x--x. 2 root root 59 July 4 15:19 Hadoop
5, modify the/home/hadoop directory and all internal files of the owner of Hadoop, belong to the group of Hadoop
[[email protected] ~]# chown hadoop:hadoop /home/hadoop[[email protected] ~ ]# chown hadoop:hadoop /home/hadoop/.*[[email protected] ~]# ll -a / Home/hadoop Total dosage 16drwx--x--x. 2 hadoop hadoop 59 7 month 4 15:19 .d-wx--x--x. 10 hadoop hadoop 4096 7 Month 4  15:19&NBSP, .... -rw-r--r--. 1 hadoop hadoop 18 7 Month 4 15:19 .bash_logout-rw-r--r--. 1 hadoop hadoop 193 7 Month 4 15:19 .bash_profile-rw-r--r--. 1 hadoop hadoop 231 7 Month 4 15:19 .bashrc[[email protected] ~]# ll /home |grep Hadoopdrwx--x--x. 2 hadoop hadoop 59 7 Month 4 15:19 hadoOp
6, show/proc/ A line in the Meminfo file that begins with uppercase or lowercase s; three ways
[[email protected] ~]# cat /proc/meminfo |grep "^[s,S]" SwapCached: 0 kBSwapTotal: 2228220 kbswapfree: 2228220 kbshmem: 8756 kBSlab: 57520 kBSReclaimable: 23232 kbsunreclaim: 34288 kB[[email protected] ~]# sed -n '/^[s,s]/p ' /proc/meminfoSwapCached: 0 kBSwapTotal: 2228220 kbswapfree: 2228220 kbshmem : 8756 kBSlab: 57520 kBSReclaimable: 23232 kBSUnreclaim: 34288 kB[[email protected] ~]# awk '/^[s,s]/' /proc/meminfoSwapCached: 0 kbswaptotal: 2228220 kBSwapFree: 2228220 kBShmem: 8756 kBSlab: 57520 kBSReclaimable: 23232 kbsunreclaim: 34288 kb
7, display/etc/passwd file whose default shell is non/ User of Sbin/nologin
[[email protected] ~]# cat /etc/passwd |grep -v /sbin/nologinroot:x:0:0: Root:/root:/bin/bashsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt :/sbin:/sbin/haltmageia:x:1100:1100::/home/linux:/bin/bashslackware:x:2002:2016::/home/slackware:/bin/ TCSHOPENSTACK:X:3003:2020::/HOME/OPENSTACK:/BIN/BASHUSER:X:3004:3004::/HOME/USER:/BIN/BASHHADOOP:X:3500:3500: :/home/hadoop:/bin/bash[[email protected] ~]# sed -n '/[*\/[^sbin]\/[^nologin]/p ' /etc/passwdroot:x:0:0:root:/root:/bin/bashsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/ sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltavahi-autoipd:x:170:170:avahi ipv4ll stack:/var/lib/ avahi-autoipd:/sbin/nologinmageia:x:1100:1100::/home/linux:/bin/bashslackware:x:2002:2016::/home/slackware:/ Bin/tcshopenstack:x:3003:2020::/home/openstack:/bin/bashuser:x:3004:3004::/home/user:/bin/bashhadoop:x : 3500:3500::/home/hadoop:/bin/bash
8. Display the user whose default shell is/bin/bash in the/etc/passwd file
[Email protected] ~]# sed-n '/\/bin\/bash$/p '/etc/passwdroot:x:0:0:root:/root:/bin/bashmageia:x:1100:1100::/home/ Linux:/bin/bashopenstack:x:3003:2020::/home/openstack:/bin/bashuser:x:3004:3004::/home/user:/bin/bashhadoop:x : 3500:3500::/home/hadoop:/bin/bash
9. Find one or two digits in the/etc/passwd file
[[email protected] ~]# awk '/\<[[:d igit:]]{1,2}\>/' /etc/passwdroot:x:0:0:root :/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm :/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/ Sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinoperator:x : 11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologinftp:x:14:50:ftp user:/var/ ftp:/sbin/nologinnobody:x:99:99:nobody:/:/sbin/nologindbus:x:81:81:system message bus:/:/sbin/ Nologintss:x:59:59:account used by the trousers package to sandbox the &NBSP;TCSD&NBSP;DAEMON:/DEV/NULL:/SBIN/NOLOGINPOSTFIX:X:89:89::/VAR/SPOOL/POSTFIX:/SBIN/NOLOGINSSHD:X:74:74: Privilege-separated ssh:/var/empty/sshd:/sbin/nologin
10. Display lines beginning with at least one whitespace character in/boot/grub/grub.conf
The file is not in CentOS 7 and a new 10.sh is created under/tmp
[[email protected] ~]# more /tmp/10.sh aaaaaaaaa bbbbbbbcccccccccccdddddddddd eeeeeeeeeee ffffffffffffff ggggggggggghhhhhhhhh iiiiiii[[email protected] ~]# cat /tmp/10.sh |grep ' ^[[:space:]]\{1, \} ' aaaaaaaaa bbbbbbb eeeeeeeeeee ffffffffffffff ggggggggggg &NBSP;IIIIIII
11, display the/etc/rc.d/rc.sysinit file to #开头, followed by at least one white-space character, and then a line with at least one non-whitespace character
[Email protected] ~]# more/tmp/11.sh# # # AAAAAAA aaaaaa aaaaaa#bbbbbb bbbbb bbbbbbbbb# cccccccccccccccc#ddddd ddddd dddddddd# eeeeee eeeee e e esdfsdf sd fsd f sdf SDF SD fsdf SD FSD [[email protected] ~]# grep ' ^#[[:space:]]\{1,\}[^[: Space:]] '/tmp/11.sh# aaaaaaa aaaaaa aaaaaa# cccccccccccccccc# eeeeee eeeee e e e E
12, the Netstat-tan command execution results in the ' LISTEN ', followed by the line with the end of the blank character
Netstat-tan | grep ' Listen[[:space:]] '
13, add user bash, Testbash, basher, Nologin (this one user's shell is/sbin/nologin), and then find out the current system on its user name and the default shell of the same user information
Useradd bashuseradd testbashuseradd basheruseradd-s/sbin/nologin nologin# egrep "^ ([[:alnum:]]+\>). *\1$"/etc/ passwd
Marco 2016 new Linux+python high-end Operation fourth week operation