拾遗: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扮 ...
随机推荐
- Android中对消息机制(Handler)的再次解读
今天遇到一些关于在子线程中操作Handler的问题,感觉又要研究源代码了,但是关于Handler的话,我之前研究过,可以参考这篇文章:http://blog.csdn.net/jiangwei0910 ...
- Github上发布托管和下载
打包托管 远程下载安装 git clone https://github/2008nmj/mnist_python 使用git工具和命令行 Git使用场景 (可以不用上传到托管平台) 写论文 分工合作 ...
- git+可视化工具+github/码云
git (实际上git和TortoiseGIT是一回事,只是TortoiseGIT把git命令行功能做了一个可视化处理,所以下面git和TortoiseGIT实现功能是一样的) 1.如何使用Git上传 ...
- selenium之 文件上传所有方法整理总结
本文转载“灰蓝”的原创博客.http://blog.csdn.net/huilan_same/article/details/52439546 文件上传是所有UI自动化测试都要面对的一个头疼问题,今天 ...
- 资源-.Net-ASP.NET:ASP.NET资源列表
ylbtech-资源-.Net-ASP.NET:ASP.NET资源列表 ASP.NETFree. Cross-platform. Open source.A framework for buildin ...
- 初探gitlab & gitlab-runner & asp.net core持续集成
文章简介 gitlab & gitlab-runner 简介 基于gitlab & gitlab-runner 的asp.net core webapi 极简持续集成实践 gitla ...
- WPF 3D
参考MSDN内容:http://msdn.microsoft.com/zh-cn/library/ms747437(v=vs.110).aspx 概述 WPF使用Viewport3D元素,将三维场景显 ...
- 线程创建后为什么要调用CloseHandle
很多程序在创建线程都这样写的: ............ ThreadHandle = CreateThread(NULL,0,.....); CloseHandel(ThreadHandle ); ...
- vim对行进行排序
vim自带排序函数sort, 在命令行模式下执行:help sort 可查看其具体用法,摘录如下: Vim has a sorting function and a sorting command. ...
- mysql shell脚本
mysql shell连接脚本 本地连接及远程链接 #!/bin/bash #连接MySQL数据库 Host=127.0.0.1 User=username PASSWORD=password POR ...