Lacks of Knowledge 1:


  Linux has large amount of COMMANDS,but many of them have similar funtions,it's annoying! So,how to get the highest efficiency in a very limited period?

  Choise only one method which cat solve your problem[s] perfectly,and throw others away!

  Just as the command "history",I will never waste my time on "!xxx","!<",etc. Because "history | grep" will solve any problems as all the others can do.

  It's same for me to deal with the chapter of user-management.I will only focus on the formats of four files(/etc/passwd,/etc/shadow/,/etc/group,/etc/gshadow) and three necessary commands("useradd","newusers","chpasswd").

  These seven tools are enough,as below:

f@z ~ $ cat /etc/passwd
qemu:x:77:77:added by portage for libvirt:/dev/null:/sbin/nologin
ldap:x:439:439:added by portage for openldap:/usr/lib64/openldap:/sbin/nologin
name:password:UID:GID:unnecessary comments of user:home directory:shell
z f # cat /etc/shadow
root:$6$QJnD:17015:0:99999:7:::
f:$6$5ajHHo.:17015:0:99999:7:::

name:password:date of last password change:minimun password age[days]:maximum password age[days]:password warning period[days]:password inactivity period[days]:account expiration date

Note:the third and eighth object(date of last password change,account expiration date) is expressed as the number of days since Jan 1, 1970.

z f # cat /etc/group
root:x:0:root
bin:x:1:root,bin,daemon
group name:password:GID:member[s] of the group
z f # cat /etc/gshadow
root:::root
bin:::root,bin,daemon
group name:password:administrator[s] of the group:member[s] of the group

newusers  :#recive arguments from file,format same as /etc/passwd

[root@ fh]# cat testfile
zhangsan:abc:::xxxx:/home/zhangsan:/bin/bash
lisi:abc:::xxxx:/home/lisi:/bin/bash
[root@ fh]# newusers testfile
[root@ fh]# tail -n /etc/passwd
zhangsan:x:::xxxx:/home/zhangsan:/bin/bash
lisi:x:::xxxx:/home/lisi:/bin/bash

chpasswd  :#recive arguments from stdin

[root@ fh]# cat testfile2
zhangsan:catdog
lisi:dogcat
[root@ fh]# cat testfile2 | chpasswd
[fh@ ~]$ su - zhangsan
Password:
-bash-4.2$

useradd -G -s -m -k

[root@ fh]# useradd -m -G wheel -s /bin/bash -k /dev/null test_user
[root@ fh]# tail -n /etc/passwd
test_user:x::::/home/test_user:/bin/bash
[root@ fh]# grep 'wheel' /etc/group
wheel:x::fh,test_user
[root@ fh]# ls -a /home/test_user/
. ..

Lacks of Knowledge 2:


setfacl -M  :#revice arguments from file

[root@ fh]# cat file1
u:fh:
g:fh:
d:u:fh:rx
mask::
[root@ fh]# setfacl -M file1 a_dir/
[root@ fh]# getfacl a_dir/
# file: a_dir/
# owner: root
# group: root
user::rwx
user:fh:rw- #effective:r--
group::r-x
group:fh:r--
mask::r-x
other::r-x
default:user::rwx
default:user:fh:r-x
default:group::r-x
default:mask::r-x
default:other::r-x

最新文章

  1. 【转】FlashBack总结之闪回查询与闪回表
  2. python安装完毕后,提示找不到ssl模块的解决步骤
  3. 把Tomcat注册为windows服务
  4. Eclipse相关设置与优化
  5. 动画黄金搭档:CADisplayLink&amp;CAShapeLayer
  6. sql server 里类似replace的字符串子串删除
  7. 转: unix实际用户ID和有效用户ID解析
  8. 用例设计工具PICT — 输入组合覆盖
  9. 关于alpha透明度
  10. 在winform中添加普通右键菜单
  11. [原]在Fedora 20环境下安装系统内核源代码
  12. C#制作一个消息拦截器(intercept)1
  13. PHP 切割字符串 点号 不用双斜杠
  14. Map的遍历方法及String和其它类型的相互转化
  15. [iOS]C语言知识点系列视频
  16. Flex移动应用程序开发的技巧和窍门(一)
  17. 全文搜索 Contains 与like 的区别
  18. 【转】fread函数详解
  19. Loj #2331. 「清华集训 2017」某位歌姬的故事
  20. Numpy的基本概念

热门文章

  1. SCP-bzoj-1068
  2. 使用HBuilder编辑器进行真机调试运行时提示Waiting for debugger!
  3. 重新学习Mysql数据库4:Mysql索引实现原理和相关数据结构算法
  4. 关于提BUG的一点思考以及工作中总结的规范
  5. Ubuntu下设置静态网址
  6. continuation line under-indented for visual indent
  7. jQuery 加载事件
  8. 安装MikTex Portable
  9. Git 学习第二天(一)
  10. springMvc请求路径解析