Linux 用户管理(二)
一、groupadd --create a new group 创建新用户
- -g --gid GID
二、groupdel --delete a group
三、passwd --update user's authentication tokens 更改用户密码
- 主要更改的文件:/etc/shadow

- --stdin
This option is used to indicate that passwd should read the new
password from standard input, which can be a pipe. 示例:
- echo stu{01..10}|tr " " "\n"|sed -r 's#(.*)#useradd \1 ; pass=$((RANDOM+10000000)); echo "$pass"|passwd --stdin \1; echo -e "\1 \t `echo "$pass"`">>/tmp/oldboy.log#g'|bash
- 上述命令实际就是再拼N条下面的命令的组合,举一条命令stu01用户的过程拆解如下:
useradd stu01 ;
pass=$((RANDOM+10000000));
echo "$pass"|passwd --stdin stu01;
echo -e "stu01 `echo "$pass"`">>/tmp/oldboy.log特别说明:如果用shell循环结构会更简单,之所以限制使用循环的目的是锻炼学生的基础命令运用
能力,学到现在还没学到SHELL循环课程呢 地址:https://user.qzone.qq.com/49000448/blog/1422183723?_t_=0.5695657615591867 -n This will set the minimum password lifetime, in days, if the
user’s account supports password lifetimes. Available to root
only. 规定多少天内不能修改密码-x This will set the maximum password lifetime, in days, if the
user’s account supports password lifetimes. Available to root
only.规定多少天之后必须修改密码及密码过期时间=当前时间+x-w This will set the number of days in advance the user will begin
receiving warnings that her password will expire, if the user’s
account supports password lifetimes. Available to root only. --过期w天之前提醒-i This will set the number of days which will pass before an
expired password for this account will be taken to mean that the
account is inactive and should be disabled, if the user’s
account supports password lifetimes. Available to root only.--密码失效时间即密码过期之后i天失效- 示例:账号test01 密码7天之内不能修改,60天之后必须修改,过期7天前提醒,过期10天后失效
[root@gaogzhen ~]# passwd -n 7 -x 60 -w 7 -i 10 test01

案例:批量更改用户密码 批量创建10个用户stu01-stu10,并且设置随机8位密码,要求不能用shell的循环(例如:for,while等),只能用linux命令及管道实现
四、chage --change user password expiry information 修改用户密码有效期
- -i --list 显示相关信息
- -E --expiredate 账号过期时间
- 其他参数功能和passwd相同,可以用passwd 替代
Linux 用户管理(二)的更多相关文章
- 11.Linux用户管理
本笔记说的Linux用户管理主要包括以下内容: 1.用户配置文件(/etc/passwd /etc/shadow) 2.组配置文件(/etc/group /etc/gshadow) 3.用户缺省配 ...
- Linux用户管理简介
Linux用户管理是Linux的优良特性之一,本文说明了Linux中用户的登录过程和登录用户的类型. 一.Linux用户登录过程 用户要使用Linux系统,必须先进行登录.Linux的登录过程和win ...
- linux 用户管理,用户权限管理,用户组管理
linux 用户管理,用户权限管理,用户组管理 一:ls -l 命令 解释 第个d表示是目录,如果是文件是-,如果是连接是l 第2到4个 rwx 表示创建者的操作权限 r 读,w 写,x 执行 第5到 ...
- 【Linux学习】Linux用户管理1—用户查询指令、用户切换
Linux用户管理1-用户查询指令.用户切换 一.用户查询指令 who: 查看当前在线用户情况 -a:显示所有用户的所有信息 -m:显示运行该程序的用户名,和"who am I"的 ...
- Linux 用户管理 与 文件权限
Linux 用户管理 与 文件权限 用户组操作 1.groupadd命令 groupadd [-g -o] gid group 各个选项具体含义如下: -g:指定新建用户组的GID号,该GID号必须唯 ...
- Linux进程管理(二)
目录 Linux进程管理(二) 参考 vmstat命令 top命令 Linux进程管理(二)
- linux 用户管理
linux 用户管理 创建一个用户 foo 这个用户只能在/home/foo 上面增加删除文件, foo 不能在其他目录加减文件 useradd -d /home/foo -m foo [root@] ...
- linux用户管理,linux用户口令管理,linux用户组管理,linux用户权限管理详解
linux用户管理 http://www.qq210.com/shoutu/android 用户账号的添加(新加用户需添加用户口令) :增加用户账号就是在/etc/passwd文件中为新用户增加一条记 ...
- Linux用户管理的复习时间
所谓三天不练手生,你还记得关于Linux用户管理的所有知识吗?现在就来跟我一起复习一下吧! 1.常用配置文件 用户信息文件: /etc/password 密码文件: /etc/shadow 用户组文件 ...
- 第七天 Linux用户管理、RHEL6.5及RHEL7.2 root密码破解、RHEL6.5安装vmware tools
1.Linux用户管理 Linux系统中,存在三种用户 A.超级用户:root 最高权限,至高无上 在windows中 administrator是可以登录的最高权限,但是,system权限最高,不能 ...
随机推荐
- ES6新特性使用小结(一)
一.let const 命令 'use strict'; /*function test(){ //let a = 1; for(let i=1;i<3;i++){ console.log(i) ...
- CodeForces - 361A-Levko and Table (思维)
Levko loves tables that consist of n rows and n columns very much. He especially loves beautiful tab ...
- 51nod1244 欧拉函数之和 杜教筛
和上一题差不多,一个是μ*I=e,一个是φ*I=Id 稍改就得到了这题的代码 (我会告诉你我一开始逆元算错了吗) #include <bits/stdc++.h> #define MAX ...
- 解读 iostat -mxd 1
#### for AWR 报告 : 建议如下: 不能随便调整db_file_multiblock_read_count 值, 取同样时间段的AWR 报告 02:00 ~ 05:00,所以db_file ...
- 转 如何观察 undo Oracle DML语句回滚开销估算
https://searchdatabase.techtarget.com.cn/7-20392/ --use_urec 详细解读: select USED_UREC from v$transacti ...
- rabbitmq 不发送ack消息如何处理:rabbitmq可靠发送的自动重试机制
转载地址:http://www.jianshu.com/p/6579e48d18ae http://www.jianshu.com/p/4112d78a8753 接这篇 在上文中,主要实现了可靠模式的 ...
- 笔试题五道spring
项目中如何体现Sping 中的切面编程,举例说明 面向切面编程:主要是横切 一个关注点,将一个关注点模块化成一个切面,在切面上声明一个通知(Advice)和切入点 (Pointcut) 通知:是指在切 ...
- 使用gulp-uncss精简css,去除冗余代码
写html页面的时候,多修改几次就会出现很多无用的css代码,下面使用gulp-uncss来精简css文件,去掉没用的css代码 1.首先找个目录创建一个gulp项目在命令行输入:npm init ...
- 定时器 & 日期时间对象 & 正则
1 JavaScript 计时事件 通过使用 JavaScript,有能力做到在一个设定的时间间隔之后来执行代码,而不是在函数被调用后立即执行,这称之为计时事件. 两个关键方法是: setInterv ...
- 有关在python中使用Redis(一)
python作为一种处理数据的脚本语言本身有许多方法函数供大家使用,有时候为了提升数据处理速度(如海量数据的访问或者海量数据的读取),涉及分布式管理架构,可能需要用到Redis,Redis是一个开源的 ...