N26-第四周作业

1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。

    ~]#cp -r /etc/skel /home/tuser1

    ~]#chmod -R go=-rwx /home/tuser1

2、编辑/etc/group文件,添加组hadoop。

    2.png

3、手动编辑/etc/passwd文件新增一行,添加用户hadoop,其基本组ID为hadoop组的id号;其家目录为/home/hadoop。

    3.png

4、复制/etc/skel目录为/home/hadoop,要求修改hadoop目录的属组和其它用户没有任何访问权限。

    ~]#cp -r /etc/skel /home/hadoop

    ~]#chmod -R go=-rwx /home/hadoop

5、修改/home/hadoop目录及其内部所有文件的属主为hadoop,属组为hadoop。

    ~]#chown -R hadoop:hadoop /home/hadoop/

6、显示/proc/meminfo文件中以大写或小写S开头的行;用两种方式;

    ~]# grep -i ^s /proc/meminfo

    ~]# grep '^[Ss]' /proc/meminfo

    ~]# grep -E '^[S|s]' /proc/meminfo

7、显示/etc/passwd文件中其默认shell为非/sbin/nologin的用户;

    ~]# grep -E -v '/sbin/nologin$' /etc/passwd|cut -d: -f1

8、显示/etc/passwd文件中其默认shell为/bin/bash的用户;

    ~]# grep -E '/bin/bash$' /etc/passwd|cut -d: -f1

9、找出/etc/passwd文件中的一位数或两位数;

    ~]# grep -E '\<[0-9]{1,2}\>' /etc/passwd

10、显示/boot/grub/grub.conf中以至少一个空白字符开头的行;

    ~]# grep -E '^[[:space:]]+' /boot/grub/grub.conf

11、显示/etc/rc.d/rc.sysinit文件中以#开头,后面跟至少一个空白字符,而后又有至少一个非空白字符的行;

    ~]# grep -E '^#[[:space:]]+[[:graph:]]' /etc/rc.d/rc.sysinit

12、打出netstat -tan命令执行结果中以‘LISTEN’,后或跟空白字符结尾的行;

    语句不通,题意不明….

13、添加用户bash, testbash, basher, nologin (此一个用户的shell为/sbin/nologin),而后找出当前系统上其用户名和默认shell相同的用户的信息;

    ~]# useradd bash

    ~]# useradd testbash

    ~]# useradd basher

    ~]# useradd -s /sbin/nologin nologin

    ~]# grep -E '(\<[[:graph:]]+\>):.*\1$' /etc/passwd

    ~]# grep -E '(^[[:graph:]]+):.*\1$' /etc/passwd

    ~]# grep "^\([[:alnum:]]\{1,\}\):.*\1$" /etc/passwd

以下题目重复

14、显示/proc/meminfo文件中以大写或小写S开头的行;用三种方式;

15、显示/etc/passwd文件中其默认shell为非/sbin/nologin的用户;

16、显示/etc/passwd文件中其默认shell为/bin/bash的用户;

17、找出/etc/passwd文件中的一位数或两位数;

原创文章,作者:oranix,如若转载,请注明出处:http://www.178linux.com/65874

(0)
oranixoranix
上一篇 2017-01-05
下一篇 2017-01-06

相关推荐

  • ssh登陆与端口转发

    ssh: secure shell, protocol, 22/tcp,  安全的远程登录     具体的软件实现:OpenSSH  : ssh 协议的开源实现,CentOS 默认安装dropbear :另一个开源实现SSH      协议版本   …

    Linux干货 2017-04-13
  • linux 权限相关知识

    linux day 6     用户、组和权限 1.Linux用户:Username/UID         管理员:root, 0         普通用户:1-65535             …

    Linux干货 2016-08-08
  • Linux文件系统

    文件是什么?存储空间内存储的有边界的一段流式数据,对数据可以做到按名存取。众多文件是如何有效的组织起来?1.  平面化把众多文件放在一起。当想查找某个文件时,需要遍历所有文件,当文件数目足够多的时候,查找一个文件将会非常慢,效率极低。2.  层级结构化根据后续查找文件的筛选条件进行分类,逐层放置,通常要查找一个文件,只需要从最高层级开始,…

    2017-09-05
  • mariadb基础应用

    mariadb基础应用 一、 前言 MariaDB is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source. Notable users …

    Linux干货 2016-12-16
  • shell-在线翻译脚本

            在linux过程中难免会碰到陌生的单词,此时不得不打开翻译软件或网页请求翻译,但这样切换界面比较麻烦,也浪费时间;         今天头脑发热,尝试着在网上找命令行翻译工具,但无果;…

    2017-02-19
  • mysql主从复制以及扩展

    一、MySQL简单复制相关概念:    1. mysql复制的意义:Mysql复制是使得mysql完成高性能应用的前提    2. mysql复制的机制:             SLAVE端线程: …

    Linux干货 2015-12-16