The Forth Week
1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。
cp -r /etc/skell /home/tuser1 ; chmod -R 700 /home/tuser
2、编辑/etc/group文件,添加组hadoop。
echo 'hadoop:x:10004:Allen' >> /etc/group
3、手动编辑/etc/passwd文件新增一行,添加用户hadoop,其基本组ID为hadoop组的id号;其家目录为/home/hadoop。
echo 'hadoop:x:10004:10004::/home/hadoop:/bin/bash' >> /etc/passwd
echo "hadoop:*:16231:0:99999:7:::" >> /etc/shadow
4、复制/etc/skel目录为/home/hadoop,要求修改hadoop目录的属组和其它用户没有任何访问权限。
cp -r /etc/skel /home/hadoop ; chmod 700 /home/hadoop
5、修改/home/hadoop目录及其内部所有文件的属主为hadoop,属组为hadoop。
chown hadop: /home/hadoop
6、显示/proc/meminfo文件中以大写或小写S开头的行;用两种方式;
grep -i “^s” /proc/meminfo
grep "^[Ss]" /proc/meminfo
egrep "^(s|S)" /proc/meminfo
awk '/^[Ss]/' /proc/meminfo
sed -n '/^[Ss]/p' /proc/meminfo
7、显示/etc/passwd文件中其默认shell为非/sbin/nologin的用户;
grep -v "/sbin/nologin$" /etc/passwd | cut -d":" -f1
8、显示/etc/passwd文件中其默认shell为/bin/bash的用户;
grep "/sbin/bash$" /etc/passwd | cut -d":" -f1
9、找出/etc/passwd文件中的一位数或两位数;
egrep "\<([0-9]|[1-9][0-9])\>" /etc/passwd
grep “/<[0-9]/{1,2/}/>” /etc/passwd
10、显示/etc/init.d/functions中以至少一个空白字符开头的行;
egrep "^ {1,}" /etc/init.d/functions
egrep "^ +" /etc/init.d/functions
grep -E '^\s' /etc/init.d/functions
11、显示/etc/services文件中以#开头,后面跟至少一个空白字符,而后又有至少一个非空白字符的行;
egrep "^#[[:space:]]+[^[:space:]]{1,}" /etc/services
egrep "^#[[:space:]]+[^[:space:]]+" /etc/services
grep -E "^#[[:space:]]+\S+" /etc/services
12、打出netstat -tan命令执行结果中以‘LISTEN’,后或跟空白字符结尾的行;
netstat -tan | egrep "LISTEN[[:space:]]{0,}$"
13、添加用户bash, testbash, basher, nologin (此一个用户的shell为/sbin/nologin),而后找出当前系统上其用户名和默认shell相同的用户的信息;
for user in bash testbash basher nologin;do useradd $user;done && chsh -s /sbin/nologin nologin && grep "^\([[:alnum:]]\+\>\).*\1$" /etc/passwd
随机推荐
- Java程序执行超时——Future接口介绍
在Java中,如果需要设定代码执行的最长时间,即超时,可以用Java线程池ExecutorService类配合Future接口来实现. Future接口是Java标准API的一部分,在java.uti ...
- Baum–Welch algorithm
Baum–Welch algorithm 世界上只有一个巴菲特,也只有一家文艺复兴科技公司_搜狐财经_搜狐网 http://www.sohu.com/a/157018893_649112
- oc76--NSMutableDictionary
// // main.m // NSMutableDictionary // NSDictionary不可变,初始化后就不可以修改,NSMutableDictionary可变,初始化后可以改变. // ...
- new (C# Reference)
https://msdn.microsoft.com/en-us/library/51y09td4.aspx In C#, the new keyword can be used as an oper ...
- Java 下的函数对象
1. 举例 如我们要创建一个对大小写敏感的,按照字母序排序的 Set,我们需要向 Set 的构造器传入 String.CASE_INSENTIVE_ORDER 的比较器: Set<String& ...
- 【线程安全】—— 单例类双重检查加锁(double-checked locking)
1. 三个版本单例类的实现 版本1:经典版 public class Singleton { public static Singleton getInstance() { if (instance ...
- css bug(ie6兼容问题)
二.五大浏览器内核1.trident(MSHTML)(三叉戟:三叉线,三齿鱼叉) Gecko (壁虎) presto(迅速的) webkit(safari内核,Chrome内核原型,他是苹果公司自己的 ...
- Ubuntu中安装部署Intel CS WebRTC
1环境要求 组件 版本要求 OS CentOS* 7.4, Ubuntu 14.04/16.04 LTS Node 8.11.* (推荐8.11.1) MongoDB 2.4.9 Boost 1.65 ...
- 【BZOJ2762】[JLOI2011]不等式组(树状数组)
题目: BZOJ2762 分析: 加入的不等式分三种情况 当\(a>0\),可以变成\(x>\lfloor \frac{c-b}{a}\rfloor\) 当\(a=0\),若\(b> ...
- 在vSphere Client上安装虚拟机工具VMware Tools
一.什么是虚拟机工具 VMware Tools是一套安装在虚拟机操作系统中的实用程序.VMware Tools可提高虚拟机的性能,并在 VMware产品中实现多个易于使用的功能. 尽管客户机操作系统在 ...