Marco Linux jobs Fourth week '

Source: Internet
Author: User

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 Go-rwx/home/tuser1


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

Vim/etc/group

First check for Hadoop groups: enter "/hadoop"

If not, add in the last line: enter ":" into edit mode, move to the last line, enter "hadoop:x:2016:" After carriage return


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/etc/passwd

First Look at Hadoop users: enter "/hadoop"

If not, add in the last line: enter ":" into edit mode, move to the last line, enter "Hadoop:x:2016:2016::/home/hadoop:/bin/bash" after carriage return

If any, replace the line with the following: "Hadoop:x:2016:2016::/home/hadoop:/bin/bash"


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 go-rwx/home/hadoop/


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


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

grep ^[ss]/proc/meminfo

Grep-i ^[s]/proc/meminfo


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


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

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


9. Find out one or two digits in/ETC/PASSW D file;

Grep-o "\<[0-9]\{1,2\}\>"/etc/passwd

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

Grep-e "^[[: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-e ' ^#[[: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 user name and default shell of the current system on the same user information;

Useradd bash && useradd testbash && useradd basher && useradd-s/sbin/nologin nologin

grep ' ^\ ([[: alnum:]]\+\>\). *\1$ '/etc/passwd


Marco Linux jobs Fourth week '

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.