Linux OPS Practice case-December 20, 2015-December 31 (first time)

Source: Internet
Author: User
Tags egrep

Linux OPS Practice case-December 20, 2015-December 31 (first time)


1. Create a 10G file system, type ext4, requires the boot can be automatically mounted to a separate data /data directory;

<1> Create a 10G partition  

[Email protected] ~]# FDISK/DEV/SDA

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to

Switch off the mode (command ' C ') and change display units to

Sectors (Command ' u ').

Command (M for help): N

<2> format type is ext4  

[Email protected] ~]# Mkfs.ext4/dev/sda3

[Email protected] ~]# Blkid/dev/sda3

<3> Create the data file, set the volume label and mount it to the /data directory  

[Email protected] ~]# Mkdir/data

[Email protected] ~]# E2label/dev/sda3/data

[Email protected] ~]# Vi/etc/fstab

will/dev/sda3 /data Ext4 default 0 0 Add to last row

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/78/AA/wKiom1aA7PDy5dKQAAA5TJetUbs281.png "style=" float: none; "title=" 1.png "alt=" Wkiom1aa7pdy5dkqaaa5tjetubs281.png "/>

2. Show ' netstat-tan ' command results with 'LISTEN' followed by 0 ,1 Lines that end with one or more whitespace characters;

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/78/AA/wKiom1aA7PCREPX4AAAdUwY5DlI706.png "title=" 2.png " Style= "Float:none;" alt= "Wkiom1aa7pcrepx4aaaduwy5dli706.png"/>

3, add UsersNginx,Zabbix,Tomcat,Nologinas wellHadoopUsers (NologinUser'sShellto be/sbin/nologin); then find out/etc/passwdthe user name in the file and itsShellname of the same row;

[[email protected] ~] # useradd Nginx

[[email protected] ~] # Useradd Zabbix

[[email protected] ~] # Useradd Tomcat

[[email protected] ~] # useradd Hadoop

[[email protected] ~] # useradd-s/sbin/nologin nologin

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/78/A9/wKioL1aA7QvCsCZ3AAAfk_I7wfA051.png "title=" 3. PNG "style=" Float:none; "alt=" Wkiol1aa7qvcscz3aaafk_i7wfa051.png "/>

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;

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/78/A9/wKioL1aA7QzQGeaZAABpOiOSWW8109.png "title=" 4.png " Style= "Float:none;" alt= "Wkiol1aa7qzqgeazaabpoiosww8109.png"/>

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

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/78/A9/wKioL1aA7Qyi-vUvAAAZ5QGAbOA326.png "title=" 5.png " Style= "Float:none;" alt= "Wkiol1aa7qyi-vuvaaaz5qgaboa326.png"/>

6. Find the/ usr directory that does not belong to root,bin , or Hadoop of all documents;

[[email protected] ~] # find/usr-not \ (-user root-o-user bin-o-user hadoop \)

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;

<1>find/-nouser-a-nogroup-a-atime-7

<2>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/78/AA/wKiom1aA7PSQ7a8JAAEewJBVF3c220.png "title=" 6.png " Style= "Float:none;" alt= "Wkiom1aa7psq7a8jaaeewjbvf3c220.png"/>

8. Create a directory /test/data, let a group of ordinary users have write permissions to it, and all the files created by the group is the directory belongs to the group, in addition, each user can only delete their own files.

[[email protected] ~] # mkdir-p/test/data

[[email protected] ~] # Groupadd Ggroup

[[email protected] ~] # chown:ggroup/test/data/

[[email protected] ~] # chmod g+w/test/data/

[[email protected] ~] # chmod g+s/test/data/

[[email protected] ~] # chmod o+t/test/data/

[[email protected] ~] # ls-ld/test/data/

Drwxrwsr-t. 2 root ggroup 6 months 15:38/test/data/


This article is from "Xin Rong" blog, please be sure to keep this source http://xinrong.blog.51cto.com/8087042/1729215

Linux OPS Practice case-December 20, 2015-December 31 (first time)

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.