Marco 2016 new Linux+python high-end Operation fourth week

Source: Internet
Author: User
Tags egrep


Content of this week's job:

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.

# cp-r/etc/skel/home/tuser1 # chmod-r 700/home/tuser1/

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/7D/wKioL1fAXhPhuybMAAAxgyaOSVo222.jpg-wh_500x0-wm_3 -wmp_4-s_211260410.jpg "title=" Fourth week -1.jpg "alt=" Wkiol1faxhphuybmaaaxgyaosvo222.jpg-wh_50 "/>


2. Edit the/etc/group file and add the group Hadoop.

# echo "hadoop:x:1003:" >>/etc/group

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/7D/wKiom1fAXk_i4vtfAAAetAWUZfw744.jpg-wh_500x0-wm_3 -wmp_4-s_1113302718.jpg "title=" Fourth week -2.jpg "alt=" Wkiom1faxk_i4vtfaaaetawuzfw744.jpg-wh_50 "/>


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.

# echo "Hadoop:x:1003:1003:hadoop:/home/hadoop:/bin/bash" >>/etc/passwd

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/86/7D/wKiom1fAXnKCt8J4AABAhGjgTqw817.jpg-wh_500x0-wm_3 -wmp_4-s_728203737.jpg "title=" Fourth week -3.jpg "alt=" Wkiom1faxnkct8j4aabahgjgtqw817.jpg-wh_50 "/>


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.

# cp-r/etc/skel//home/hadoop # chmod 700/home/hadoop/

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/7D/wKioL1fAXsHwVj6MAAAxavOXgog991.jpg-wh_500x0-wm_3 -wmp_4-s_1429403367.jpg "title=" Fourth week -4.jpg "alt=" Wkiol1faxshwvj6maaaxavoxgog991.jpg-wh_50 "/>


5, modify the/home/hadoop directory and all the internal files of the owner of Hadoop, belong to Hadoop group.

# chown-r hadoop.hadoop/home/hadoop/# or # chown-r hadoop:hadoop/home/hadoop/

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/7D/wKioL1fAXuPRa34bAABfJ-bUYus153.jpg-wh_500x0-wm_3 -wmp_4-s_19243652.jpg "title=" Fourth week -5.jpg "alt=" Wkiol1faxupra34baabfj-buyus153.jpg-wh_50 "/>


6. Display the lines in the/proc/meminfo file beginning with uppercase or lowercase s, in two ways;

# grep-i ' ^s '/proc/meminfo # grep ' ^[ss] '/proc/meminfo

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/86/7D/wKiom1fAX2XCHRJlAABU0h3ggfo449.jpg-wh_500x0-wm_3 -wmp_4-s_1843697284.jpg "title=" Fourth week -6.jpg "alt=" Wkiom1fax2xchrjlaabu0h3ggfo449.jpg-wh_50 "/>


7. Display the default shell of the/etc/passwd file as a non-/sbin/nologin user;

# grep-v '/sbin/nologin '/etc/passwd | Cut-d:-f1

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/86/7D/wKioL1fAYDnxOiC8AABzimnMFfg409.jpg-wh_500x0-wm_3 -wmp_4-s_1709094620.jpg "title=" Fourth week -7.jpg "alt=" Wkiol1faydnxoic8aabzimnmffg409.jpg-wh_50 "/>

8. Display the user whose default shell is/bin/bash in/etc/passwd file;

# grep '/bin/bash '/etc/passwd | Cut-d:-f1


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/7D/wKiom1fAYMvCbFVJAABgXkFFB9Q541.jpg-wh_500x0-wm_3 -wmp_4-s_334667911.jpg "title=" Fourth week -8.jpg "alt=" Wkiom1faymvcbfvjaabgxkffb9q541.jpg-wh_50 "/>


9. Find out one or two digits in the/etc/passwd file;

# grep-o ' \b[0-9]\{1,2\}\b '/etc/passwd

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/86/7D/wKiom1fAYSLyp5iHAAArkQ2PVUw485.jpg-wh_500x0-wm_3 -wmp_4-s_3212174210.jpg "title=" Fourth week -9.jpg "alt=" Wkiom1fayslyp5ihaaarkq2pvuw485.jpg-wh_50 "/>


10. Display the line beginning with at least one blank character in/boot/grub/grub.conf;

# egrep ' ^[[:space:]]+ '/boot/grub/grub.conf

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/7D/wKiom1fAYV_QFAx4AABIU0w1Dcs597.jpg-wh_500x0-wm_3 -wmp_4-s_3596912759.jpg "title=" Fourth week -10.jpg "alt=" Wkiom1fayv_qfax4aabiu0w1dcs597.jpg-wh_50 "/>


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;

# egrep ' ^#[[:space:]]+[^[:space:]]+ '/etc/rc.d/rc.sysinit

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/86/7D/wKioL1fAYYiQSbbNAAEUd85Gpis842.jpg-wh_500x0-wm_3 -wmp_4-s_3050901466.jpg "title=" Fourth week -11.jpg "alt=" Wkiol1fayyiqsbbnaaeud85gpis842.jpg-wh_50 "/>


12, the Netstat-tan command execution results in the "LISTEN", followed by or with a blank character end of the line;

# Netstat-tan | Egrep ' listen[[:space:]]*$ '

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/7D/wKioL1fAYa_iXOc5AABNwxVzl7I532.jpg-wh_500x0-wm_3 -wmp_4-s_1510796698.jpg "title=" Fourth week -12.jpg "alt=" Wkiol1faya_ixoc5aabnwxvzl7i532.jpg-wh_50 "/>


13, add user bash, Testbash, basher, Nologin (this 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;

# useradd Bash && useradd testbash && useradd basher && useradd-s/sbin/nologin nologin # grep ' ^\ ([[: alnum:]]\+\b\). *\1$ '/etc/passwd # or # awk-f ' [:/] ' $1== $NF {print $} '/etc/passwd

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/86/7D/wKioL1fAYeqR5qFRAABgPeTx3bs195.jpg-wh_500x0-wm_3 -wmp_4-s_998716708.jpg "title=" Fourth week -13.jpg "alt=" Wkiol1fayeqr5qfraabgpetx3bs195.jpg-wh_50 "/>

This article is from the "ld0381 Learning Journey" blog, please be sure to keep this source http://ld0381.blog.51cto.com/3318114/1843141

Marco 2016 new Linux+python high-end Operation fourth week

Related Article

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.