拾遗:Linux 用户及权限管理基础
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 用户及权限管理基础的更多相关文章
- Linux用户和权限——管理文件权限的命令
Linux用户和权限——管理文件权限的命令 摘要:本文主要学习了Linux中修改文件权限的命令. chown命令 chown命令,主要用于修改文件(或目录)的所有者,除此之外,这个命令也可以修改文件( ...
- Linux用户和权限——管理用户和用户组的命令
Linux用户和权限——管理用户和用户组的命令 摘要:本文主要学习了在Linux系统中管理用户和用户组的命令. useradd命令 useradd命令可以用来创建新用户. 基本语法 useradd [ ...
- linux用户及权限管理
[文件管理.管道.用户及组管理.用户及权限管理]\用户及组管理 用户与组管理 Linux系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这 ...
- Linux用户和权限管理看了你就会用啦
前言 只有光头才能变强 回顾前面: 看完这篇Linux基本的操作就会了 没想到上一篇能在知乎获得千赞呀,Linux也快期末考试了,也有半个月没有写文章了.这篇主要将Linux下的用户和权限知识点再整理 ...
- 4.Linux用户与权限管理
Linux 系统是一个多用于多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统 新增用户: useradd 新用户名 设置密码:pa ...
- Linux用户和权限管理
用户:资源获取标识符,资源分配,安全权限模型的核心要素之一 密码:来实现用户认证 创建用户:useradd Username 生成的属性信息 /etc/passwd 用户名:密码:占位符:UID:GU ...
- 3-4 linux 用户及权限管理
1. 安全上下文(secure context) 取决于资源权限和进程权限 分为三种:r:读,w:写,x:执行 每一类用户都有三个权限 文件: r:可读,可以使用类似cat等命令来查看文件内容 w:可 ...
- MySQL基础篇(07):用户和权限管理,日志体系简介
本文源码:GitHub·点这里 || GitEE·点这里 一.MySQL用户 1.基础描述 在数据库的使用过程中,用户作为访问数据库的鉴权因素,起到非常重要的作用,安装MySQL时会自动生成一个roo ...
- linux 用户创建、管理、权限分配
(1)su与sudo su:通过su可以在用户之间切换,如果超级权限用户root向普通或虚拟用户切换不需要密码,什么是权力?这就是!而普通用户切换到其它任何用户都需要密码验证: sudo: sudo扮 ...
随机推荐
- react 教程—核心概念
react 核心概念 : https://react.docschina.org/docs/getting-started.html(官网) 或 https://www.w3cschool.cn/ ...
- python之-sqlite3
在这些 URL 中,hostname 表示 MySQL 服务所在的主机,可以是本地主机(localhost),也可以是远程服务器.数据库服务器上可以托管多个数据库,因此 database 表示要使用的 ...
- STM32嵌入式开发学习笔记(七):串口通信(下)
下面我们进行几个串口通信的实际应用. 实验一:发信实验,让开发板通过串口向电脑发送信息: #include <stdio.h> #include <stm32f10x.h> # ...
- adapter设计模式
适配器设计模式 将一个类的接口转换成客户希望的另外一个接口.Adapter 模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作 例如:现在有一个220V的插口,而手机不能直接接上去,因为锂电 ...
- 深入理解JAVA虚拟机原理之内存分配策略(二)
更多Android高级架构进阶视频学习请点击:https://space.bilibili.com/474380680 1.对象优先在Eden分配 大多情况,对象在新生代Eden区分配.当Eden区没 ...
- python面试题之你如何管理不同版本的代码?
答案: 版本管理!被问到这个问题的时候,你应该要表现得很兴奋,甚至告诉他们你是如何使用Git(或是其他你最喜欢的工具)追踪自己和奶奶的书信往来.我偏向于使用Git作为版本控制系统(VCS),但还有其他 ...
- python xlwt设置单元格的自定义背景颜色
我使用python 2.7和xlwt模块进行excel导出 我想设置我知道可以使用的单元格的背景颜色 style1 = xlwt.easyxf('pattern: pattern solid, for ...
- 关于VS的第一次使用
参考链接:https://blog.csdn.net/qq_36556893/article/details/88605617
- eduCF#61 F. Clear the String /// 区间DP 消除连续一段相同字符 全部消完的最少次数
题目大意: 给定字符串 每次消除可消除连续的一段相同的字符的子串 求消除整个字符串的最少消除次数 #include <bits/stdc++.h> using namespace std; ...
- URL&HTTP协议&GET请求&POST请求
1.什么是URL URL的全称是Uniform Resource Locator(统一资源定位符) 通过1个URL,能找到互联网上唯一的1个资源 URL就是资源的地址.位置,互联网上的每个资源都有一个 ...