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-a/etc/skel/home/tuser1 #复制文件 [[email protected] ~]# chmod-r go=/home/tuser1 #设 Reset Permissions
[[email protected] tuser1]# ll -a /etc/skel #查看原来文件权限total 24drwxr-xr-x. 3 root root 74 aug  27 10:44 .DRWXR-XR-X. 86 ROOT ROOT 8192 AUG 27 15:18&NBSP, .... -rw-r--r--. 1 root root 18 aug 3 00:00 .bash_ Logout-rw-r--r--. 1 root root 193 aug 3 00:00 .bash_ Profile-rw-r--r--. 1 root root 231 aug 3 00:00 . bashrcdrwxr-xr-x. 4 root root 37 aug 27 09:36 . mozilla[[email protected] tuser1]# ll -a /home/tuser1 #查看/home/tuser1 and its internal file permissions total 12drwx------. 3 root root 74 Aug 27 16:54 .drwxr-XR-X. 3 ROOT ROOT  19 AUG 27 16:54&NBSP, .... -RW-------.  1 ROOT ROOT  18 AUG 27 16:54 .BASH_LOGOUT-RW-------.  1 ROOT ROOT 193 AUG 27 16:54 .BASH_PROFILE-RW-------. 1 ROOT ROOT 231 AUG 27 16:54 .BASHRCDRWX------. 4 root root 37 aug 27 16:54 .mozilla
2. Edit the/etc/group file and add the group Hadoop.
#使用vim或者vi打开编辑/etc/group, add the record at the end of the file [[email protected] etc]# vim/etc/grouphadoop:x:565
Press ESC,:WQ to save and exit the file when finished
3. Manually edit the/etc/passwd 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.
#使用vim或者vi打开编辑/etc/group, add the record at the end of the file [[email protected] etc]# vim/etc/passwdhadoop:x:567:567:hadoop:/home/hadoop:/ Sbin/nologin
Press ESC,:WQ to save and exit the file when finished
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] etc]# cp-r/etc/skel/home/hadoop[[email protected] etc]# chmod-r go=/home/hadoop
5, modify the/home/hadoop directory and all the internal files of the owner of Hadoop, belong to Hadoop group.
#为对比修改前后的不同, let's look at the previous file properties before modifying:[[email protected] etc]# ll -a /home/hadooptotal 12DRWX------. 3 root root 74 aug 27 17:24 .drwxr-xr-x. 4  ROOT ROOT  32 AUG 27 17:24&NBSP, .... -RW-------.  1 ROOT ROOT  18 AUG 27 17:24 .BASH_LOGOUT-RW-------.  1 ROOT ROOT 193 AUG 27 17:24 .BASH_PROFILE-RW-------. 1 ROOT ROOT 231 AUG 27 17:24 .BASHRCDRWX------. 4 root root 37 aug 27 17:24 .mozilla# modified file belongs to the main genus group: [[[Email protected] etc]# chown -r hadoop:hadoop /home/hadoop# View the properties of the modified file [[Email protected] etc]# ll -a  /HOME/HADOOPTOTAL 12DRWX------. 3 hadoop hadoop 74 Aug 27 17:24 .drwxr-xr-x. 4 root root 32 aug 27 17:24 -RW-------. 1 hadoop hadoop 18 aug 27 17:24 .bash_ LOGOUT-RW-------. 1 hadoop hadoop 193 aug 27 17:24 .bash_ PROFILE-RW-------. 1 hadoop hadoop 231 aug 27 17:24 .bashrcdrwx------. 4 hadoop hadoop 37 aug 27 17:24 .mozilla
6. Display the lines in the/proc/meminfo file beginning with uppercase or lowercase s, in two ways;
Way 1:[[email protected] ~]# grep "^[SS]"/proc/meminfo Way 2: Use parameter-I,--ignore-case[[email protected] ~]# grep-i "^s"/proc/me Minfo
7. Display the default shell of the/etc/passwd file as a non-/sbin/nologin user;
[[email protected] ~]# grep "/sbin/nologin$"/etc/passwd
8. Display the user whose default shell is/bin/bash in/etc/passwd file;
[[email protected] ~]# grep "/bin/bash$"/etc/passwd
9. Find out one or two digits in the/etc/passwd file;
[[email protected] ~]# grep "\<[[:d igit:]]\{,2\}\>"/etc/passwd or: [[email protected] ~]# grep "\b[0-9]\{1,2\}\b"/ etc/passwd
10. Display the line beginning with at least one blank character in/boot/grub/grub.conf;
#CentOS7. x does not have this file and needs to be operated on centos6.x [[email protected] ~]# 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;
#CentOS7. x does not have this file and needs to be operated on centos6.x [[email protected] ~]# 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;
[Email protected] ~]# 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] ~]# useradd bash[[email protected] ~]# useradd testbash[[email protected] ~]# useradd Basher[[email Pro Tected] ~]# useradd-s/sbin/nologin nologin[[email protected] ~]# grep "^\ ([[: alnum:]]\+\>\). *\1$"/etc/passwd
This article is from the "Set Sail" blog, please make sure to keep this source http://mystery888.blog.51cto.com/9560453/1843355
Marco Linux Fourth week