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

拾遗:Linux 用户及权限管理基础的更多相关文章

  1. Linux用户和权限——管理文件权限的命令

    Linux用户和权限——管理文件权限的命令 摘要:本文主要学习了Linux中修改文件权限的命令. chown命令 chown命令,主要用于修改文件(或目录)的所有者,除此之外,这个命令也可以修改文件( ...

  2. Linux用户和权限——管理用户和用户组的命令

    Linux用户和权限——管理用户和用户组的命令 摘要:本文主要学习了在Linux系统中管理用户和用户组的命令. useradd命令 useradd命令可以用来创建新用户. 基本语法 useradd [ ...

  3. linux用户及权限管理

    [文件管理.管道.用户及组管理.用户及权限管理]\用户及组管理 用户与组管理 Linux系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这 ...

  4. Linux用户和权限管理看了你就会用啦

    前言 只有光头才能变强 回顾前面: 看完这篇Linux基本的操作就会了 没想到上一篇能在知乎获得千赞呀,Linux也快期末考试了,也有半个月没有写文章了.这篇主要将Linux下的用户和权限知识点再整理 ...

  5. 4.Linux用户与权限管理

    Linux 系统是一个多用于多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统 新增用户: useradd  新用户名 设置密码:pa ...

  6. Linux用户和权限管理

    用户:资源获取标识符,资源分配,安全权限模型的核心要素之一 密码:来实现用户认证 创建用户:useradd Username 生成的属性信息 /etc/passwd 用户名:密码:占位符:UID:GU ...

  7. 3-4 linux 用户及权限管理

    1. 安全上下文(secure context) 取决于资源权限和进程权限 分为三种:r:读,w:写,x:执行 每一类用户都有三个权限 文件: r:可读,可以使用类似cat等命令来查看文件内容 w:可 ...

  8. MySQL基础篇(07):用户和权限管理,日志体系简介

    本文源码:GitHub·点这里 || GitEE·点这里 一.MySQL用户 1.基础描述 在数据库的使用过程中,用户作为访问数据库的鉴权因素,起到非常重要的作用,安装MySQL时会自动生成一个roo ...

  9. linux 用户创建、管理、权限分配

    (1)su与sudo su:通过su可以在用户之间切换,如果超级权限用户root向普通或虚拟用户切换不需要密码,什么是权力?这就是!而普通用户切换到其它任何用户都需要密码验证: sudo: sudo扮 ...

随机推荐

  1. Android中的surfaceHolder.lockCanvas(null)返回为null详解

    对于新手学习SurfaceView的时候获取lockCanvas的时候总是返回null的问题很是纠结 canvas = surfaceHolder.lockCanvas(new Rect(0, 0, ...

  2. js监听input输入字符变化

    <p class="text-input"> <input type="text" id="username" autoC ...

  3. 【前端技术】一篇文章搞掂:JS

    待补充 //以下等价 if(val) if(val!=null&&val!=undefined&&val!="") //以下等价 if(!val) ...

  4. this关键字的使用!

    class Student{ String name; int age; Student(String name,int age){ this.name=name; this.age=age; } S ...

  5. Codeforces Round#498(Div.3)D. Two Strings Swaps

    题目 题意是给了两个字符串a和b,然后可以对这两个字符串有三种操作来使这两个字符串相等,一是交换a[i]和b[i],二是交换a[i]和a[n-i+1],三是交换b[i]和b[n-i+1],这三个操作都 ...

  6. python 获取手机设备号

    上代码 ##获取设备多台设备号列表 def get_deviceid(): str_init=' ' all_info= os.popen('adb devices').readlines() pri ...

  7. Dubbo入门到精通学习笔记(三):持续集成管理平台之SVN版本管理系统的安装和使用

    文章目录 持续集成管理平台介绍 持续集成介绍 持续集成管理平台的组成 持续集成实践介绍 即将学习 SVN版本管理系统的安装 安装 Subversion + Apache 安装 jsvnadmin 简单 ...

  8. spark hive java.lang.NoSuchFieldError: HIVE_STATS_JDBC_TIMEOUT

    java.lang.NoSuchFieldError: HIVE_STATS_JDBC_TIMEOUT 这个问题我感觉是hive给spark挖的一个大坑.spark版本是2.4.4,hive是3 这个 ...

  9. arttemplate 后台返回的数据格式问题

    1. 2.JSON.parse() 方法用于将一个 JSON 字符串转换为对象. $("body").on("click","#analyze&quo ...

  10. autocad 2015 破解方法

    下载 http://trial.autodesk.com/SWDLDNET4/2015/ACD/DLM/AutoCAD_2015_Simplified_Chinese_Win_64bit_dlm.sf ...