Linux OPS Practice case-December 20, 2015-December 31

Source: Internet
Author: User
Tags create directory egrep

1 , create a 10G file system, type EXT4, require the boot can be automatically mounted to a separate data/data directory;

Fdisk/dev/sda

Mkfs–t/dev/sda4

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/BD/wKioL1aaFgqgMyhCAABPH1AcBwM236.png "title=" 3.png " Style= "Float:none;" alt= "Wkiol1aafgqgmyhcaabph1acbwm236.png"/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/BD/wKioL1aaFgmyuWkzAABBycg7T6o583.png "style=" float: none; "title=" 1.png "alt=" Wkiol1aafgmyuwkzaabbycg7t6o583.png "/>

Add/dev/sda3/data ext4 default 0 0 to last row

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/BD/wKioL1aaFgmhVvLWAAA4qrXysUg635.png "style=" float: none; "title=" 2.png "alt=" Wkiol1aafgmhvvlwaaa4qrxysug635.png "/>


2 , display the ' netstat-tan ' command result with ' LISTEN ' followed by 0, one or more whitespace characters end of the line;

Netstat–tan | grep "listen[]*$"

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/BD/wKioL1aaFguTrxiUAAAfe-vNnX4787.png "style=" float: none; "title=" 4.png "alt=" Wkiol1aafgutrxiuaaafe-vnnx4787.png "/>

3 , add user Nginx, Zabbix, Tomcat, Nologin, and Hadoop users (nologin user's shell is/sbin/nologin), then find out/etc/ A row in the passwd file that has the same user name as its shell name;

Useradd Nginx

Useradd Zabbix

Useradd Tomcat

Useradd Nologin

Useradd Hadoop

Usermod–s/sbin/nologgin

Grep–e "(^[[:alnum:]]*\>). *\l$"/etc/passwd


4 , find a word in the/etc/rc.d/init.d/functions file (the middle of the word can be underlined) followed by a set of parentheses line;

Grep-e "_? [[: Alpha:]]*\ (\) "/etc/init.d/functions

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/BE/wKiom1aaFdaQlBgcAAAmECq6IwM537.png "style=" float: none; "title=" 6.png "alt=" Wkiom1aafdaqlbgcaaamecq6iwm537.png "/>

5 , use echo to output a path, and then egrep find its path base name, and further use Egrep to remove its directory name (note that the directory name, not the directory path);

echo "/etc/init.d/functions" | Egrep-o "[[: alum:]]*/?$] | Cut-d/-F1

6 , look for all files that do not belong to root, bin, or Hadoop in the/usr directory;

Find/usr! \ (-user root-o-user bin-o-user hadoop \)-exec ls-l {} \;

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/79/BD/wKioL1aaFgyzqgUwAAAhpWUiLqI409.png "style=" float: none; "title=" 7.png "alt=" Wkiol1aafgyzqguwaaahpwuilqi409.png "/>

7 , one day the system was invaded, hackers in your system to leave the Trojan file:

You now need to find all the files on the current system that are not owned by the master or group and have been visited in the last week;

In addition, it is necessary to find all files of more than 20k and type ordinary files in/etc directory;

Find/-atime-7-a \ (-nouser-o-nogroup \) – LS

Find/etc-type f-size +20k-exec ls-l {} \; |head-n 10

8 , Create directory/test/data, let the normal user in a group have write permission to it, and all the files created belong to the group that the directory belongs to, in addition, each user can only delete their own files.

1, mkdir–p/tesr/data

2. Groupadd Work

3, Chmod g+w/test/data

4, Chmod g+s//test/data

5, Chmod o+t/test/data

6, ls–ld/test/data

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/79/BD/wKioL1aaFgyyaw1MAAArFgal7hk287.png "style=" float: none; "title=" 8.png "alt=" Wkiol1aafgyyaw1maaarfgal7hk287.png "/>


Linux OPS Practice case-December 20, 2015-December 31

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.