考试信息:
IPADDR: 172.25.x.100(X 在这里指您的工作站编号)
NETMASK: 255.255.255.0
GATEWAY: 172.25.x.254
DNS: 172.25.254.254
yum源地址为:ftp://172.25.x.250/pub/rhel7.0
1.在进行考试之前,请先重置根用户密码为 examwestos
[[email protected] ~]# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
2.更改主机名称为 station.domainX.example.com(X 在这里指您的工作站编号)
[[email protected] ~]# hostnamectl set-hostname station.domain19.example.com
[[email protected] ~]# hostname
station.domain19.example.com
3新建组,名称为 sysadms,指定其 GID 为 600
[[email protected] ~]# groupadd -g 600 sysadms
4新建用户 tommy,指定 UID 为 2013,配置该用户密码为 redhat
[[email protected] ~]# useradd -u 2013 tommy
[[email protected] ~]# id tommy
uid=2013(tommy) gid=2013(tommy) groups=2013(tommy)
[[email protected] ~]# passwd tommy
Changing password for user tommy.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]#
5新建用户 Jimmy,,并且禁止该用户交互式登录,配置该用户密码为 redhat
[[email protected] ~]# cat /etc/shells ##通过该命令可以查看该系统可支持的shell类型
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh
[[email protected] ~]# useradd -s /sbin/nologin Jimmy
[[email protected] ~]# passwd Jimmy
Changing password for user Jimmy.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
6新建用户 natasha,harry, 并将这两个用户加入到 sysadms 组当中,作为从属组,如果需要,则将用户密码配置为 redhat
[[email protected] ~]# useradd -g sysadms natasha
[[email protected] ~]# useradd -g sysadms harry
[[email protected] ~]# passwd natasha
Changing password for user natasha.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]# passwd harry
Changing password for user harry.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
7在/home 目录中创建目录 materials,配置该目录的所属组为 sysadms,要求隶属于 sysadms 组当中的成员对该目录有读写权限,在
sysadms目录当中创建的文件或者文件夹,其所属组也
自动继承 sysadms 的所属组
[[email protected] ~]# mkdir /home/materials
[[email protected] ~]# chgrp sysadms /home/materials -R
[[email protected] ~]# chmod g+rw /home/materials
[[email protected] ~]# chmod g+s /home/materials
8拷贝/etc/fstab 文件到/var/tmp 目录中,设置以下需求
[[email protected] ~]# cp /etc/fstab /var/tmp/
使 harry 用户对该文件无任何权限
[[email protected] ~]# setfacl -m u:harry: /var/tmp/fstab
setfacl: Option -m incomplete
使 natasha 对该文件有完全控制权限
[[email protected] ~]# setfacl -m u:natasha:rwx /var/tmp/fstab
配置文件所属用户为 root
[[email protected] ~]# chown root /var/tmp/fstab
配置文件所属组为 root
[[email protected] ~]# chgrp root /var/tmp/fstab
其他所有用户对文件拥有读权限
[[email protected] ~]# chmod o+r /var/tmp/fstab
其他所有用户对文件没有执行权限
[[email protected] ~]# chmod o-x /var/tmp/fstab
9设置 NTP 客户端,与172.25.x.254进行时间同步
[[email protected] ~]# vim /etc/chrony.conf
3 server 172.25.19.254 iburst
[[email protected] ~]# systemctl restart chronyd.service
##客户端不用关闭防火墙,服务端必须要关防火墙
10找出用户组mail 拥有的文件,并且将它们放到/root/findresults 目录中
11在文件/usr/share/mime/packages/freedesktop.org.xml 中查找所有包含 ich 的行,将找
出的行按照先后顺序拷贝到/root/lines
文件中,/root/lines 文件不包含空格,并且其中行的内容是源文件/usr/share/mime/packages/freedesktop.org.xml 原始行的
准确副本