Unit 5

一:用户理解

用户就是系统使用者的身份在系统中用户存储为若干串字符+若干个系统配置文件

用户信息涉及到的系统配置文件:

/etc/passwd                                                                                ###用户信息

用户:密码:uid:gid:说明:家目录:用户使用的shell

/etc/shadow                                                                                ###用户认证信息

用户:密码:最后一次密码修改该时间:最短有效期:最长有效期:警告期:非活跃期:帐号到期日

/etc/group             ##组信息

组名称:组密码:组id:附加组成员

/etc/gshadow            ##组认证信息

/home/uesername          ##用户家目录

/etc/skel/.*            ##用户骨架文件

二:用户管理

####1.用户建立


useradd


参数


用户名字


-u


##指定用户uid


-g


##指定用户初始组信息,这个组必须已经存在


-G


##指定附加组,这个组必须存在


-c


##用户说明


-d


##用户家目录


-s


##用户所使用的shell,/etc/shells记录了用户能使用shell的名字

####2.用户删除


userdel


-r


用户名称 -r表示删除用户信息及用户的系统配置

####3.组的建立


groupadd


-g


##建立组


groupdel


组名字


##删除组

做以上实验的监控命令:

watch -n 1 ‘tail -n 3 /etc/passwd/etc/group;echo ====;ls -l /home;echo ====;ls -l /mnt‘

####4.用户id信息查看


id


参数


用户


-u


##用户uid


-g


##用户初始组id


-G


##用户所有所在组id


-n


##显示名称而不是id数字


-a


##显示所有信息

####5.用户信息更改


usermod 参数


用户


-l


##更改用户名称


-u


##更改uid


-g


##更改gid


-G


##更改附加组


-aG


##添加附加组


-c


##更改说明


-d


##更改家目录指定


-md


##更改家目录指定及家目录名称


-s


##更改shell


-L


##冻结帐号


-U


##解锁

三:用户权力下放

1.在系统中超级用户可以下放普通用户不能执行的操作给普通用户

下放权力配置文件:/etc/sudoers

2.下放权力的方法

1)超级用户执行visudo进入编辑/etc/sudoers模式

2)格式:

获得权限用户 主机名称=(获得到的用户身份) 命令

test  desktop0.example.com=(root)  /usr/sbin/useradd

test用户能在desktop0.example.com以超级用户身份执行/usr/sbin/useradd

3.执行下放权限命令

sudo            命令            ##如果第一次执行sudo需要输入当前用户密码

/etc/sudoers中如果设置如下:

testdesktop0.example.com=(root)                    NOPASSWD: /usr/sbin/useradd

表示用户调用sudo命令的时候不需要自己密码

四:用户认证信息的控制

chage参数用户

-d                                                    ##用户密码组后一次修改的时间,如果设定成0,用户登陆系统后必须修改自己的密码

-m                                                   ##最短有效期

-M                                                    ##最长有效期

-W                                                    ##警告期

-I                                                       ##用户非活跃天数

-E                                                      ##帐号到期日格式 -E "YYYY-MM-DD"

时间: 2024-08-07 17:00:06

Unit 5的相关文章

mysqld服务启动失败, Failed to restart mysqld.service: Unit not found.

-bash-4.2# service mysqld restart Redirecting to /bin/systemctl restart mysqld.serviceFailed to restart mysqld.service: Unit not found. 并不存在 mysqld 的服务, -bash-4.2# -bash-4.2# chkconfig -list -list: unknown option -bash-4.2# chkconfig --list Note: Thi

10.23 linux任务计划cron10.24chkconfig工具10.25 systemd管理服务10.26 unit介绍 10.27 target介绍

- 10.23 linux任务计划cron - 10.24 chkconfig工具 - 10.25 systemd管理服务 - 10.26 unit介绍 - 10.27 target介绍 - 扩展 1. anacron http://blog.csdn.net/strikers1982/article/details/4787226  2. xinetd服(默认机器没有安装这个服务,需要yum install xinetd安装) http://blog.sina.com.cn/s/blog_46

CentOS 7 防火墙 出现Failed to start iptables.service: Unit iptables.service failed to load

错误信息如下: [root]# service iptables start Redirecting to /bin/systemctl start iptables.service Failed to start iptables.service: Unit iptables.service failed to load: No such file or directory.解决方法如下: 一直用CentOS 6 习惯了,一下没适应过来.防火墙配置后执行service iptables sav

GRU(Gated Recurrent Unit) 更新过程推导及简单代码实现

GRU(Gated Recurrent Unit) 更新过程推导及简单代码实现 RNN GRU matlab codes RNN网络考虑到了具有时间数列的样本数据,但是RNN仍存在着一些问题,比如随着时间的推移,RNN单元就失去了对很久之前信息的保存和处理的能力,而且存在着gradient vanishing问题. 所以有些特殊类型的RNN网络相继被提出,比如LSTM(long short term memory)和GRU(gated recurrent unit)(Chao,et al. 20

2 unit 4

###unit.4管理系统存储### ###1.分区划分 fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Buil

2 unit 5

###unit.5 LVM### ###1.LVM建立 1.划分物理分区并把分区id修改为8e [[email protected] ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not

(4.5.4)Android测试TestCase单元(Unit test)测试和instrumentationCase单元测试

Android单元和instrumentation单元测试 Developing Android unit and instrumentation tests Android的单元测试是基于JUnit的.可分为: 1.本地单元测试 - 可以在JVM上运行测试(速度快,优先考虑). 2.Instrumented单元测试 - 需要Android系统 Android的Gradle插件支持在JVM上执行Andr??oid单元测试.它使用特殊版本的android.jar(也称为 Android mocka

ABP领域层——工作单元(Unit Of work)

ABP领域层——工作单元(Unit Of work) 点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之12.ABP领域层——工作单元(Unit Of work) ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)”的简称. ABP的官方网站:http://www.aspnetboilerplate.com ABP在Github上的开源项目:https://github.com/aspnetboilerplate 通用

Karma install steps for unit test of Angular JS app

npm install -g karma npm install –g karma-cli Install the plugins (optional)           # Install plugins that your project needs:  npm install karma-jasmine karma-chrome-launcher --save-dev Run following command to do unit test:           C:\Users\Br

.NET MVC4 实训记录之四(Unit of work + Repository)

今日后开启进阶模式! 谈到MVC与EntityFramework,则不得不说一说事务与仓储(Unit of work + Repository). 仓储(Repository):领域对象集合.用于操作领域对象与数据库上下文(DbContext)的交互(在此不得不说一声,领域对象和数据库表对象还是有区别的.领域对象实际上是一组有业务关系的数据库对象的抽象.最简单的形式就是主表.关系表在同一个领域对象中进行定义.例如我们前几章看到的UserProfile,它即定义了用户信息,又定义了用户角色关系信息