马哥教育网络班22期第四周课程练习1

1.cp -r /etc/skel/ /home/tuser1 && chmod -R 600  /home/tuser1

2.max=`cat /etc/group |awk -F":" '{print $3}'|sort -nr| head -n1`|sed -i '$a hadoop:x:'$((max+1)) /etc/group

3.maxuser=`cat /etc/passwd |awk -F":" '{print $3}'|sort -nr|head -n1` && hadoopgroup=`grep "hadoop" /etc/group|awk -F":" '{print $3}'`|sed -i '$a hadoop:x:'$((maxuser+1)):$maxgroup::/home/hadoop:/bin/bash /etc/passwd

4.与第一题一样,略

5.chown -R hadoop:hadoop /home/hadoop

6.cat /proc/meminfo | egrep ^[Ss]

cat /proc/meminfo | awk '{if($1~/^[Ss]/) print}'

7.cat /etc/passwd | awk -F":" {'if($NF!="/bin/bash") print $1'} 

8.cat /etc/passwd | awk -F":" {'if($NF=="/bin/bash") print $1'} 

9.cat /etc/passwd | awk -F":" {'if(length($1)<=2) print $1'} 

10.cat /boot/grub/grub.conf | egrep "^[[:space:]]+"

11.cat /etc/rc.d/rc.sysinit  | egrep –color "^#[[:space:]]+[[:graph:]]+"

12.netstat -tan | egrep –color "LISTEN[[:space:]]+"

13.for i in bash testbash basher ; do useradd $i ; done ; useradd nologin -s /sbin/nologin && for i in `egrep -o "^[[:alnum:]]+" /etc/passwd `; do egrep "($i).*\1$" /etc/passwd;done

原创文章,作者:未闻花名,如若转载,请注明出处:http://www.178linux.com/43420

(0)
未闻花名未闻花名
上一篇 2016-09-05 08:52
下一篇 2016-09-05 08:52

相关推荐

  • linux-用户和组的基本管理

    用户和组

    2018-03-20
  • 开班第一天

    我的一篇小日记

    Linux干货 2018-03-26
  • 例图分析软、硬链接

    在linux系统中存在两种链接方式硬链接和软连接,两种链接方式在系统中是完全不同的模式,本文主要详述两种的区别并给与图示; 创建guo ,lin两个文件,两个文件分别用于演示软连接和硬链接     图一:创建文件   创建软连接guo.ruan1     图二:创建软连…

    Linux干货 2016-10-29
  • 网络接口配置bonding

    Bonding 就是将多块网卡绑定同一IP地址对外提供服务,可以实现高可用或者负载均衡。当然,直接给两块网卡设置同一IP地址是不可能的。通过bonding,虚拟一块网卡对外提供连接,物理网卡的被修改为相同的MAC地址。 Bonding的工作模式 Mode 0 (balance-rr)     轮转(…

    Linux干货 2016-09-09
  • 马哥教育网络班21期+第7周课程练习

    1、创建一个10G分区,并格式为ext4文件系统; (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl; [root@localhost ~]# fdisk /dev/sda WARNING: DOS-compatible mode is&n…

    Linux干货 2016-08-24
  • 管理systemd

    管理systemd init(系统的第一个进程): CentOS 5: SysV initCentOS 6: UpstartCentOS 7: Systemd Systemd:系统启动和服务器守护进程管理器,负责在系统启动或运行时,激活系统资源,服务器进程和其它进程 Systemd新特性: 系统引导时实现服务并行启动 按需启动守护进程 系统状态快照 自动化的…

    Linux干货 2016-09-22

评论列表(1条)

  • 马哥教育
    马哥教育 2016-09-13 13:50

    没有很好的按照第三周老师的方式来改善哦,希望改进下;
    PS:题目+格式渲染更好。加油