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] Desktop]# cp-r/etc/skel/home/tuser1
[Email protected] Desktop]# chmod-r 700/home/tuser1/
2. Edit the/etc/group file and add the group Hadoop.
[[Email protected] Desktop]# Vim/etc/group
[Email protected] Desktop]# tail-1/etc/group
HADOOP:X:2005:
3. Manually edit the/ETC/PASSW D file to add a new line, adding user Hadoop, whose basic group ID is the Hadoop group ID number; its home directory is/home/hadoop.
[[Email protected] Desktop]# vim/etc/passwd
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s1.51cto.com/wyfs02/m01/86/74/wkiom1e_ecarahcsaaaewloifym721.png-wh_500x0-wm_3-wmp_4-s_2710910754.png "title = "QQ picture 20160825234125.png" alt= "Wkiom1e_ecarahcsaaaewloifym721.png-wh_50"/>
[[Email protected] Desktop]# ID Hadoop
uid=2005 (Hadoop) gid=2005 (Hadoop) group =2005 (Hadoop)
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] Desktop]# cp-r/etc/skel/home/hadoop
[Email protected] hadoop]# chmod 700/home/hadoop
5, modify the/home/hadoop directory and all internal files of the owner of Hadoop, belong to the group of Hadoop
[Email protected] hadoop]# chown-r Hadoop:hadoop/home/hadoop
[Email protected] hadoop]# ls-l/Home
Total Dosage 36
DRWX------. 5 Hadoop hadoop 4096 August 23:57 Hadoop
6. Display the lines in the/proc/meminfo file beginning with uppercase or lowercase s, in two ways;
[Email protected] hadoop]# grep-i ^s/proc/meminfo
swapcached:0 KB
swaptotal:2031612 KB
swapfree:2031612 KB
shmem:4348 KB
slab:101132 KB
sreclaimable:32508 KB
sunreclaim:68624 KB
[[email protected] hadoop]# grep ^[SS]/proc/meminfo
swapcached:0 KB
swaptotal:2031612 KB
swapfree:2031612 KB
shmem:4348 KB
slab:101096 KB
sreclaimable:32508 KB
sunreclaim:68588 KB
7. Display/ETC/PASSW D file whose default shell is non-/sbin/nologin user;
Grep-v '/sbin/nologin '/etc/passwd | Cut-d:-f1
8. Display the user whose default shell is/bin/bash in/ETC/PASSW D file;
Grep-v "/bin/bash"/etc/passwd | Cut-d: F1
9. Find out one or two digits in/ETC/PASSW D file;
grep "\<[0-9]\{1,2\}\>"/etc/passwd
10. Display the line beginning with at least one blank character in/boot/grub/grub.conf;
grep "^[[:space:]]"/boot/grub/grub.conf
11, the display/etc/rc.d/rc.sysinit file with the beginning of #, followed by at least one white space character, and then have at least one non-whitespace character line;
grep "^#[[:space:]]\+[^[:space:]]\+"/etc/rc.d/rc.sysinit
12, the Netstat-tan command execution results in the "LISTEN", followed by or with a blank character end of the line;
Netstat-tan | grep ' listen[[:space:]]*$ '
13, add user bash, Testbash, basher, Nologin (this one user's shell is/sbin/nologin), and then find the current system on its user name and the default shell of the same user information;
[[Email protected] Desktop]# useradd bash
[Email protected] Desktop]# useradd testbash
[Email protected] Desktop]# useradd basher
[Email protected] ~]# useradd-s/sbin/nologin nologin
Linux Jobs (iv)