linux怎么运行exam,《 rh124-exam》linux练习

考试信息:

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

[root@localhost ~]# passwd

Changing password for user root.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

3004822781fdeb6dc138ce0a54dd7e51.png

2.更改主机名称为 station.domainX.example.com(X 在这里指您的工作站编号)

[root@localhost ~]# hostnamectl set-hostname station.domain19.example.com

[root@localhost ~]# hostname

station.domain19.example.com

71ac550ca68e4abb5d4f7ca4d8e037ed.png

3新建组,名称为 sysadms,指定其 GID 为 600

[root@localhost ~]# groupadd -g 600 sysadms

ddc02d21b6b58a596fd434b0d8a7fd9c.png

4新建用户 tommy,指定 UID 为 2013,配置该用户密码为 redhat

[root@localhost ~]# useradd -u 2013 tommy

[root@localhost ~]# id tommy

uid=2013(tommy) gid=2013(tommy) groups=2013(tommy)

[root@localhost ~]# 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.

[root@localhost ~]#

494da521ec4ab47d4d99e37acfe07e90.png

5新建用户 Jimmy,,并且禁止该用户交互式登录,配置该用户密码为 redhat

[root@localhost ~]# cat /etc/shells           ##通过该命令可以查看该系统可支持的shell类型

/bin/sh

/bin/bash

/sbin/nologin

/usr/bin/sh

/usr/bin/bash

/usr/sbin/nologin

/bin/tcsh

/bin/csh

[root@localhost ~]# useradd -s /sbin/nologin Jimmy

[root@localhost ~]# 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.

2e5e26118e02b8c3d2040dcf5496899d.png

6新建用户 natasha,harry, 并将这两个用户加入到 sysadms 组当中,作为从属组,如果需要,则将用户密码配置为 redhat

[root@localhost ~]# useradd -g sysadms natasha

[root@localhost ~]# useradd -g sysadms harry

[root@localhost ~]# 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.

[root@localhost ~]# 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.

32209d457320223a91c223aab072b726.png

7在/home 目录中创建目录 materials,配置该目录的所属组为 sysadms,要求隶属于 sysadms 组当中的成员对该目录有读写权限,在

sysadms目录当中创建的文件或者文件夹,其所属组也

自动继承 sysadms 的所属组

[root@localhost ~]# mkdir /home/materials

[root@localhost ~]# chgrp sysadms /home/materials -R

[root@localhost ~]# chmod g+rw /home/materials

[root@localhost ~]# chmod g+s /home/materials

b8020a6f842fc03dd408e618ea5b4555.png

8拷贝/etc/fstab 文件到/var/tmp 目录中,设置以下需求

[root@station ~]# cp /etc/fstab /var/tmp/

使 harry 用户对该文件无任何权限

[root@station ~]# setfacl -m u:harry: /var/tmp/fstab

setfacl: Option -m incomplete

使 natasha 对该文件有完全控制权限

[root@station ~]# setfacl -m u:natasha:rwx /var/tmp/fstab

配置文件所属用户为 root

[root@station ~]# chown root /var/tmp/fstab

配置文件所属组为 root

[root@station ~]# chgrp root /var/tmp/fstab

其他所有用户对文件拥有读权限

[root@station ~]# chmod o+r /var/tmp/fstab

其他所有用户对文件没有执行权限

[root@station ~]# chmod o-x /var/tmp/fstab

9设置 NTP 客户端,与172.25.x.254进行时间同步

[root@station ~]# vim /etc/chrony.conf

3 server 172.25.19.254 iburst

[root@station ~]# systemctl restart chronyd.service

##客户端不用关闭防火墙,服务端必须要关防火墙

593679628b70aa080f7cf71bde7eabb5.png

10找出用户组mail 拥有的文件,并且将它们放到/root/findresults 目录中

[root@station ~]# find / -group mail -exec mv {} /root/findresults \;

find: ‘/proc/2818/task/2818/fd/6’: No such file or directory

find: ‘/proc/2818/task/2818/fdinfo/6’: No such file or directory

find: ‘/proc/2818/fd/6’: No such file or directory

find: ‘/proc/2818/fdinfo/6’: No such file or directory

mv: ‘/root/findresults/mail’ and ‘/root/findresults/mail’ are the same file

[root@station ~]# cd /root/findresults/

[root@station findresults]# ls

mail

acb6ba1d8d609c261a49c767f4d7b524.png

c9eac7a5cb58895674e20b6143e7263c.png8e81e3e0398283a0da8271ce78159217.png

9233eb8f778247ecf2568f76e5df8611.png

11在文件/usr/share/mime/packages/freedesktop.org.xml 中查找所有包含 ich 的行,将找

出的行按照先后顺序拷贝到/root/lines

文件中,/root/lines 文件不包含空格,并且其中行的内容是源文件/usr/share/mime/packages/freedesktop.org.xml 原始行的

准确副本

[root@station ~]# grep ich /usr/share/mime/packages/freedesktop.org.xml >/root/lines

[root@station ~]# vim /root/lines

:%s/^\ //g          ##清空每行最前的空格

:wq                 ##保存退出

3ca67e01bf4db695811e1e8f9ae46ca8.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值