博主本人平和谦逊,热爱学习,读者阅读过程中发现错误的地方,请帮忙指出,感激不尽


文章说明:本文是作者原创,请尊重个人劳动成果,转载需注明出处,博主19年通过考试,成绩是满分

一、设置环境:

请初始化您的考试虚拟机 server0.example.com,将系统的 root 账号密码设置为 123456 。
配置您的虚拟机系统使用下述静态网络配置:

* Hostname:server0.example.com 
* IP address:172.25.0.11 
* Netmask:255.255.255.0 
* Gateway:172.25.0.254 
* Name server:172.25.254.254

解题:

1.1.修改密码

  1. 按“e”进入编辑模式
  2. utf-8后面添加空格 rd.break
  3. Ctrl + x执行
  1.  

  1. 以读写权限重新挂载硬盘上的真实系统根目录:
  2. mount -o remount,rw / /sysroot
  3. 切换至真实系统根目录:
  4. chroot /sysroot
  5. 按要求修改root密码:
  6. echo 123456 | passwd --stdin root
  7. 重新打标:
  8. touch /.autorelabel
  9. 退出真实系统:
  10. exit
  11. 退出系统重新引导:
  12. exit
  13. 以新密码登录系统

1.2.设置主机名

  1. [root@server0 ~]# hostnamectl set-hostname server0.example.com
  2. [root@server0 ~]# bash
  3. [root@server0 ~]# hostname
  4. server0.example.com
  5. [root@server0 ~]#

1.3.设置网络

  1. [root@server0 ~]# nmcli connection modify eth0 ipv4.addresses "172.25.0.11/24 172.25.0.254" ipv4.dns "172.25.254.254" connection.autoconnect yes ipv4.method manual
  2. [root@server0 ~]# nmcli connection reload
  3. [root@server0 ~]# service network restart
  4. Restarting network (via systemctl): [ OK ]
  5. [root@server0 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
  6. DEVICE=eth0
  7. BOOTPROTO=none
  8. ONBOOT=yes
  9. TYPE=Ethernet
  10. USERCTL=yes
  11. IPV6INIT=no
  12. NAME=eth0
  13. PERSISTENT_DHCLIENT=
  14. IPADDR0=172.25.0.11
  15. PREFIX0=
  16. GATEWAY0=172.25.0.254
  17. DNS1=172.25.254.254
  18. DOMAIN=server0.example.com
  19. DEFROUTE=yes
  20. IPV4_FAILURE_FATAL=no
  21. UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
  22. [root@server0 ~]#

二、设置SELinux

请保证系统 SELinux 运行在 Enforcing 状态,要求系统重启仍然生效

解题:

  1. [root@server0 ~]# setenforce 1
  2. [root@server0 ~]# getenforce
  3. Enforcing
  4. [root@server0 ~]#
    [root@server0 ~]# vim /etc/selinux/config 

[root@server0 ~]# reboot

三、配置yum源

配置你的本地默认 YUM 仓库指向 http://classroom.example.com/content/rhel7.0/x86_64/dvd

解题:

  1. [root@server0 ~]# yum-config-manager --help | grep add
  2. --downloaddir=DLDIR
  3. --add-repo=ADDREPO add (and enable) the repo from the specified file or
  4. [root@server0 ~]# yum-config-manager --add-repo="http://classroom.example.com/content/rhel7.0/x86_64/dvd/"
  5. Loaded plugins: langpacks
  6. adding repo from: http://classroom.example.com/content/rhel7.0/x86_64/dvd/
  7.  
  8. [classroom.example.com_content_rhel7.0_x86_64_dvd_]
  9. name=added from: http://classroom.example.com/content/rhel7.0/x86_64/dvd/
  10. baseurl=http://classroom.example.com/content/rhel7.0/x86_64/dvd/
  11. enabled=
  12.  
  13. [root@server0 ~]# echo "gpgcheck=0">>/etc/yum.repos.d/classroom.example.com_content_rhel7.0_x86_64_dvd_.repo
  14. [root@server0 ~]# yum clean all
  15. Loaded plugins: langpacks
  16. Cleaning repos: classroom.example.com_content_rhel7.0_x86_64_dvd_ rhel_dvd
  17. Cleaning up everything
  18. [root@server0 ~]# yum makecache
  19. Loaded plugins: langpacks
  20. classroom.example.com_content_rhel7.0_x86_64_dvd_ | 4.1 kB ::
  21. rhel_dvd | 4.1 kB ::
  22. (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/group_gz | kB ::
  23. (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/primary_db | 3.4 MB ::
  24. (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/other_db | 1.3 MB ::
  25. (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/productid | 1.6 kB ::
  26. (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/filelists_db | 3.0 MB ::
  27. (/): rhel_dvd/group_gz | kB ::
  28. (/): rhel_dvd/primary_db | 3.4 MB ::
  29. (/): rhel_dvd/other_db | 1.3 MB ::
  30. (/): rhel_dvd/filelists_db | 3.0 MB ::
  31. Metadata Cache Created
  32. [root@server0 ~]# yum repolist
  33. Loaded plugins: langpacks
  34. repo id repo name status
  35. classroom.example.com_content_rhel7.0_x86_64_dvd_ added from: http://classroom.example.com/content/ 4,305
  36. rhel_dvd Remote classroom copy of dvd ,
  37. repolist: ,
  38. [root@server0 ~]#

四、调整逻辑卷

1. 新建一个逻辑卷,名字为lv0 ,其属于 vg0 卷组,该逻辑卷由 16 个 LE 组成。卷组 vg0 的单个 PE 大小为 16 MiB。将新创建的逻辑卷格式化为 xfs 文件系统,在系统启动时,该逻辑卷会被自动挂载到 /mnt/lvm 目录下。

2. 将逻辑卷 lv0 和其文件系统大小调整到 384 MiB。要确保文件系统中的内容保持完整。请注意:分区大小很少能够完全符合要求的大小,所以大小在 352 MiB 和 416 MiB 之间都是可以接受的。

解题:

4.1.划分1G的LVM

  1. [root@server0 ~]# fdisk /dev/vdb
  2. Welcome to fdisk (util-linux 2.23.).
  3.  
  4. Changes will remain in memory only, until you decide to write them.
  5. Be careful before using the write command.
  6.  
  7. Device does not contain a recognized partition table
  8. Building a new DOS disklabel with disk identifier 0x095042ab.
  9.  
  10. Command (m for help): p
  11.  
  12. Disk /dev/vdb: 10.7 GB, bytes, sectors
  13. Units = sectors of * = bytes
  14. Sector size (logical/physical): bytes / bytes
  15. I/O size (minimum/optimal): bytes / bytes
  16. Disk label type: dos
  17. Disk identifier: 0x095042ab
  18.  
  19. Device Boot Start End Blocks Id System
  20.  
  21. Command (m for help): n
  22. Partition type:
  23. p primary ( primary, extended, free)
  24. e extended
  25. Select (default p): e
  26. Partition number (-, default ):
  27. First sector (-, default ):
  28. Using default value
  29. Last sector, +sectors or +size{K,M,G} (-, default ): +1G
  30. Partition of type Extended and of size GiB is set
  31.  
  32. Command (m for help): n
  33. Partition type:
  34. p primary ( primary, extended, free)
  35. l logical (numbered from )
  36. Select (default p): l
  37. Adding logical partition
  38. First sector (-, default ):
  39. Using default value
  40. Last sector, +sectors or +size{K,M,G} (-, default ):
  41. Using default value
  42. Partition of type Linux and of size MiB is set
  43.  
  44. Command (m for help): t
  45. Partition number (,, default ):
  46. Hex code (type L to list all codes): 8e
  47. Changed type of partition 'Linux' to 'Linux LVM'
  48.  
  49. Command (m for help): w
  50. The partition table has been altered!
  51.  
  52. Calling ioctl() to re-read partition table.
  53. Syncing disks.
  54. [root@server0 ~]# partprobe
  55. [root@server0 ~]#

4.2.按要求添加逻辑卷

  1. [root@server0 ~]# pvcreate /dev/vdb5
  2. Physical volume "/dev/vdb5" successfully created
  3. [root@server0 ~]# vgcreate --help | grep size
  4. [-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]]
  5. [root@server0 ~]# vgcreate vg0 -s 16M /dev/vdb5
  6. Volume group "vg0" successfully created
  7. [root@server0 ~]# vgdisplay
  8. --- Volume group ---
  9. VG Name vg0
  10. System ID
  11. Format lvm2
  12. Metadata Areas
  13. Metadata Sequence No
  14. VG Access read/write
  15. VG Status resizable
  16. MAX LV
  17. Cur LV
  18. Open LV
  19. Max PV
  20. Cur PV
  21. Act PV
  22. VG Size 1008.00 MiB
  23. PE Size 16.00 MiB
  24. Total PE
  25. Alloc PE / Size /
  26. Free PE / Size / 1008.00 MiB
  27. VG UUID jvZd9h-nV9v-ankV-skjP-btgB-vF8R-W67IRT
  28.  
  29. [root@server0 ~]# lvcreate -n lv0 -l 16 vg0
  30. Logical volume "lv0" created
  31. [root@server0 ~]# lvdisplay
  32. --- Logical volume ---
  33. LV Path /dev/vg0/lv0
  34. LV Name lv0
  35. VG Name vg0
  36. LV UUID n8oBJF-9caQ-COg8-2peS-pWTz-mQDj-rXHUKL
  37. LV Write Access read/write
  38. LV Creation host, time server0.example.com, -- :: +
  39. LV Status available
  40. # open
  41. LV Size 256.00 MiB
  42. Current LE
  43. Segments
  44. Allocation inherit
  45. Read ahead sectors auto
  46. - currently set to
  47. Block device :
  48.  
  49. [root@server0 ~]# mkfs.xfs /dev/vg0/lv0
  50. meta-data=/dev/vg0/lv0 isize= agcount=, agsize= blks
  51. = sectsz= attr=, projid32bit=
  52. = crc=
  53. data = bsize= blocks=, imaxpct=
  54. = sunit= swidth= blks
  55. naming =version bsize= ascii-ci= ftype=
  56. log =internal log bsize= blocks=, version=
  57. = sectsz= sunit= blks, lazy-count=
  58. realtime =none extsz= blocks=, rtextents=
  59. [root@server0 ~]#

4.3.设置自动挂载

  1. [root@server0 ~]# mkdir -p /mnt/lvm
  2. [root@server0 ~]# blkid
  3. /dev/vda1: UUID="9bf6b9f7-92ad-441b-848e-0257cbb883d1" TYPE="xfs"
  4. /dev/vdb5: UUID="KydhrK-3Nar-ktHy-b6Gq-skNj-sIQu-MgWCmm" TYPE="LVM2_member"
  5. /dev/mapper/vg0-lv0: UUID="11ddc813-2a94-46f7-a7de-e735eb8bfe8c" TYPE="xfs"
  6. [root@server0 ~]# echo "UUID="11ddc813-2a94-46f7-a7de-e735eb8bfe8c" /mnt/lvm xfs defaults 0 0">>/etc/fstab
  7. [root@server0 ~]# mount -av
  8. / : ignored
  9. mount: /mnt/lvm does not contain SELinux labels.
  10. You just mounted an file system that supports labels which does not
  11. contain labels, onto an SELinux box. It is likely that confined
  12. applications will generate AVC messages and not be allowed access to
  13. this file system. For more details see restorecon() and mount().
  14. /mnt/lvm : successfully mounted
  15. [root@server0 ~]# df -lh | grep lv0
  16. /dev/mapper/vg0-lv0 253M 13M 240M % /mnt/lvm
  17. [root@server0 ~]#

4.4.扩容

  1. [root@server0 ~]# lvextend -L 384M /dev/vg0/lv0
  2. Extending logical volume lv0 to 384.00 MiB
  3. Logical volume lv0 successfully resized
  4. [root@server0 ~]# xfs_growfs /dev/vg0/lv0
  5. meta-data=/dev/mapper/vg0-lv0 isize= agcount=, agsize= blks
  6. = sectsz= attr=, projid32bit=
  7. = crc=
  8. data = bsize= blocks=, imaxpct=
  9. = sunit= swidth= blks
  10. naming =version bsize= ascii-ci= ftype=
  11. log =internal bsize= blocks=, version=
  12. = sectsz= sunit= blks, lazy-count=
  13. realtime =none extsz= blocks=, rtextents=
  14. data blocks changed from to
  15. [root@server0 ~]# df -lh | grep lv0
  16. /dev/mapper/vg0-lv0 381M 14M 368M % /mnt/lvm
  17. [root@server0 ~]#

五、按照以下要求创建用户、组

• 新建一个名为adminuser的组,id为40000
• 新建一个natasha的用户,并将adminuser作为其附属组
• 新建一个harry用户,并将adminuser作为其附属组
• 新建一个sarah的用户,其不属于adminuser组,在系统送没有任何可交互的shell
• natasha、harry、和sarah三个用户的密码均设为rehat

解题:

  1. [root@server0 ~]# groupadd --help | grep id
  2. -g, --gid GID use GID for the new group
  3. -K, --key KEY=VALUE override /etc/login.defs defaults
  4. [root@server0 ~]# groupadd -g 40000 adminuser
  5. [root@server0 ~]# cat /etc/group | grep 4000
  6. adminuser:x::
  7. [root@server0 ~]# useradd --help | grep group
  8. -g, --gid GROUP name or ID of the primary group of the new
  9. -G, --groups GROUPS list of supplementary groups of the new
  10. -N, --no-user-group do not create a group with the same name as
  11. -U, --user-group create a group with the same name as the user
  12. [root@server0 ~]# useradd -G adminuser natasha
  13. [root@server0 ~]# useradd -G adminuser harry
  14. [root@server0 ~]# useradd --help | grep shell
  15. -s, --shell SHELL login shell of the new account
  16. [root@server0 ~]# useradd -s /sbin/nologin sarah
  17. [root@server0 ~]# cat /etc/passwd | grep sarah
  18. sarah:x::::/home/sarah:/sbin/nologin
  19. [root@server0 ~]# echo rehat | passwd --stdin natasha
  20. Changing password for user natasha.
  21. passwd: all authentication tokens updated successfully.
  22. [root@server0 ~]# echo rehat | passwd --stdin harry
  23. Changing password for user harry.
  24. passwd: all authentication tokens updated successfully.
  25. [root@server0 ~]# echo rehat | passwd --stdin sarah
  26. Changing password for user sarah.
  27. passwd: all authentication tokens updated successfully.
  28. [root@server0 ~]#

六、配置文件权限

• 该文件的所属组为root
• 该文件的所属人为root
• 该文件对任何人均没有执行权限
• 用户natasha对该文件有读和写权限
• 用户harry对该文件既不能读也不能写
• 所有用户(包括当前用户和未来创建的用户)对该文件都有读的权限

解题:

  1. [root@server0 ~]# cp -a /etc/fstab /var/tmp/
  2. [root@server0 ~]# chown root:root /var/tmp/fstab
  3. [root@server0 ~]# chmod a-x /var/tmp/fstab
  4. [root@server0 ~]# setfacl -Rm u:natasha:rw,u:harry:-- /var/tmp/fstab
  5. [root@server0 ~]# chmod a+r /var/tmp/fstab
  6. [root@server0 ~]# getfacl /var/tmp/fstab
  7. getfacl: Removing leading '/' from absolute path names
  8. # file: var/tmp/fstab
  9. # owner: root
  10. # group: root
  11. user::rw-
  12. user:natasha:rw-
  13. user:harry:---
  14. group::r--
  15. mask::rw-
  16. other::r--
  17.  
  18. [root@server0 ~]#

七、建立计划任务

• 对natasha用户建立计划任务,要求在本地时间的每天14:23执行 /bin/echo "rhcsa" 命令

  1. [root@server0 ~]# crontab -e -u natasha
  2. [root@server0 ~]# crontab -l -u natasha
  3. # mim hour day month week command
  4. * * * /bin/echo "rhcsa"
  5.  
  6. [root@server0 ~]#

八、创建共享目录

• /home/admins目录的所属组为adminuser
• 该目录对adminuser组的成员可读可写可执行,但是对其它用户没有任何权限,但是root不受限制
• 在/home/admins目录下创建的文件所属组自动被设置为adminuser

解题:

  1. [root@server0 ~]# mkdir /home/admins
  2. [root@server0 ~]# chgrp adminuser /home/admins/
  3. [root@server0 ~]# chmod g=rwx,o=-- /home/admins/
  4. [root@server0 ~]# chmod g+s /home/admins/
  5. [root@server0 ~]# ls -ld /home/admins/
  6. drwxrws---. root adminuser Dec : /home/admins/
  7. [root@server0 ~]# getfacl /home/admins/
  8. getfacl: Removing leading '/' from absolute path names
  9. # file: home/admins/
  10. # owner: root
  11. # group: adminuser
  12. # flags: -s-
  13. user::rwx
  14. group::rwx
  15. other::---
  16. [root@server0 ~]#

九、升级系统内核

• 当系统重新启动之后,升级的内核要作为默认的内核
• 原来的内核要被保留,并且仍然可以正常启动
• A 新内核的 RPM 包在http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages
注意事项:使用连接的时候一定要在连接尾部添加“/”

解题:

  1. [root@server0 ~]# curl -s http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/ | grep kernel
  2. <tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]"></td><td><a href="kernel-3.10.0-123.1.2.el7.x86_64.rpm">kernel-3.10.-123.1...&gt;</a></td><td align="right">-- : </td><td align="right"> 29M</td><td>&nbsp;</td></tr>
  3. <tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]"></td><td><a href="kernel-doc-3.10.0-123.1.2.el7.noarch.rpm">kernel-doc-3.10.-..&gt;</a></td><td align="right">-- : </td><td align="right"> 12M</td><td>&nbsp;</td></tr>
  4. [root@server0 ~]# wget http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-123.1.2.el7.x86_64.rpm
  5. ---- ::-- http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-123.1.2.el7.x86_64.rpm
  6. Resolving classroom.example.com (classroom.example.com)... 172.25.254.254
  7. Connecting to classroom.example.com (classroom.example.com)|172.25.254.254|:... connected.
  8. HTTP request sent, awaiting response... OK
  9. Length: (29M) [application/x-rpm]
  10. Saving to: kernel-3.10.-123.1..el7.x86_64.rpm
  11.  
  12. %[=================================================>] ,, .1MB/s in .4s
  13.  
  14. -- :: (82.1 MB/s) - kernel-3.10.-123.1..el7.x86_64.rpm saved [/]
  15.  
  16. [root@server0 ~]# ls
  17. anaconda-ks.cfg Documents kernel-3.10.0-123.1.2.el7.x86_64.rpm Pictures Templates
  18. Desktop Downloads Music Public Videos
  19. [root@server0 ~]# chmod 755 kernel-3.10.0-123.1.2.el7.x86_64.rpm
  20. [root@server0 ~]# rpm -ivh kernel-3.10.0-123.1.2.el7.x86_64.rpm
  21. warning: kernel-3.10.-123.1..el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
  22. Preparing... ################################# [%]
  23. Updating / installing...
  24. :kernel-3.10.-123.1..el7 ################################# [%]
  25. [root@server0 ~]# grub2-editenv list
  26. saved_entry=Red Hat Enterprise Linux Server (3.10.-123.1..el7.x86_64) 7.0 (Maipo)
  27. [root@server0 ~]# reboot

十、绑定外部验证

• 在 classroom.example.com    上已部署了一台 LDAP 认证服务器,按以下要求配置你的系统

• 加入到该 LDAP 服务中,并使用 Kerberos 认证用户密码

• 该 LDAP 认证服务的Base DN为:dc=example,dc=com .

• 该 LDAP 认证服务的LADP Server为 :classroom.example.com

• 该认证服务的 Kerbros Realm 为:EXAMPLE.COM

• 该认证服务的 Kerbros KDC为:classroom.example.com

• 该认证服务的 Kerbros Admin Server为:classroom.example.com

• 认证的会话连接需要被加密,证书的下载地址为  http://classroom.example.com/pub/example-ca.crt

解题:

10.1.安装必备软件

  1. [root@server0 ~]# yum install authconfig-gtk sssd krb5-workstation -y
  2. [root@server0 ~]# authconfig-gtk

10.2.配置LDAP

  1. 上面配置完成再进行(没有配置的话sssd服务无法启动):
  2. [root@server0~]# systemctl enable sssd
  3. [root@server0~]# systemctl restart sssd
  4. [root@server0~]# systemctl status sssd
  5. [root@server0~]# su ldapuser0
  6. bash-4.2$
  7. 验证用户:ldapuser0

[root@server0 ~]# systemctl restart sssd
[root@server0 ~]# su ldapuser0
bash-4.2$ exit
exit
[root@server0 ~]# getent passwd ldapuser0
ldapuser0:*:1700:1700:LDAP Test User 0:/home/guests/ldapuser0:/bin/bash
[root@server0 ~]#

  1.  

十一、配置autofs

  • classroom.example.com 使用 NFS 共享了/home/guests 给你的系统。这个文件系统包含了预先设置好的用户 ldapuser0 的家目录;
  • ldapuser0 的家目录是 classroom.example.com:/home/guests/ldapuser0 ;
  • ldapuser0 的家目录应该自动挂载到本地的 /home/guests/ldapuser0 家目录必须对用户具有可写权限;
  • ldapuser0 的密码是 'kerberos’

解题:

11.1.安装软件

  1. [root@server0 ~]# yum install autofs -y
  2. [root@server0 ~]# systemctl enable autofs.service

11.2.设置挂载

  1. [root@server0 ~]# cp -a /etc/auto.misc /etc/auto.aa
  2. [root@server0 ~]# echo "/home/guests /etc/auto.aa" >>/etc/auto.master
  3. [root@server0 ~]# echo "* -type=nfs,rw classroom.example.com:/home/guests/&">>/etc/auto.aa
  4. [root@server0 ~]# systemctl restart autofs.service
  5. [root@server0 ~]# ssh ldapuser0@localhost
  6. ldapuser0@localhost's password: (kerberos)
  7. Last login: Wed Dec :: from localhost
  8. [ldapuser0@server0 ~]$ cd /home/guests/
  9. [ldapuser0@server0 guests]$ ls
  10. ldapuser0
  11. [ldapuser0@server0 guests]$

十二、配置NTP

配置你的系统时间与服务器 classroom.example.com 同步

解题:

12.1.如图

12.2.设置开机启动

  1. [root@server0 ~]# systemctl enable chronyd
  2. [root@server0 ~]# systemctl restart chronyd.service
  3. [root@server0 ~]# chronyc sources -v
  4. Number of sources =
  5.  
  6. .-- Source mode '^' = server, '=' = peer, '#' = local clock.
  7. / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
  8. | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
  9. || .- xxxx [ yyyy ] +/- zzzz
  10. || / xxxx = adjusted offset,
  11. || Log2(Polling interval) -. | yyyy = measured offset,
  12. || \ | zzzz = estimated error.
  13. || | |
  14. MS Name/IP address Stratum Poll Reach LastRx Last sample
  15. ===============================================================================
  16. ^* classroom.example.com +796ns[ -21us] +/- 1176us
  17. [root@server0 ~]#

十三、创建归档

• 创建一个名为 /root/sysconfig.tar.bz2的归档文件,其中包含了/etc/sysconfig目录中的内容。tar归档文件
必须使用bzip2进行压缩。

解题:

  1. [root@server0 ~]# man tar | grep zip2
  2. -j, --bzip2
  3. filter the archive through bzip2
  4. -j, --bzip2
  5. filter the archive through bzip2
  6. [root@server0 ~]# tar -jcf /root/sysconfg.tar.bz2 /etc/sysconfig/

十四、创建一个用户

  • 用户id=3456 用户名:jay
  • 密码为:glegunle

解题:

  1. [root@server0 ~]# useradd -u 3456 jay
  2. [root@server0 ~]# echo "glegunge"|passwd --stdin jay
  3. Changing password for user jay.
  4. passwd: all authentication tokens updated successfully.
  5. [root@server0 ~]# id jay
  6. uid=(jay) gid=(jay) groups=(jay)
  7. [root@server0 ~]#

十五、添加swap分区

• swap分区的容量为512M
• 当您的系统启动时,swap分区可以自动挂载
• 不要移动或是修改其它已经存在于您的系统中的swap分区

解题:

  1. [root@server0 ~]# fdisk /dev/vdb
  2. Welcome to fdisk (util-linux 2.23.).
  3.  
  4. Changes will remain in memory only, until you decide to write them.
  5. Be careful before using the write command.
  6.  
  7. Command (m for help): n
  8. Partition type:
  9. p primary ( primary, extended, free)
  10. l logical (numbered from )
  11. Select (default p): p
  12. Partition number (-, default ):
  13. First sector (-, default ):
  14. Using default value
  15. Last sector, +sectors or +size{K,M,G} (-, default ): +512M
  16. Partition of type Linux and of size MiB is set
  17.  
  18. Command (m for help): t
  19. Partition number (,,, default ):
  20. Hex code (type L to list all codes):
  21. Changed type of partition 'Linux' to 'Linux swap / Solaris'
  22.  
  23. Command (m for help): w
  24. The partition table has been altered!
  25.  
  26. Calling ioctl() to re-read partition table.
  27.  
  28. WARNING: Re-reading the partition table failed with error : Device or resource busy.
  29. The kernel still uses the old table. The new table will be used at
  30. the next reboot or after you run partprobe() or kpartx()
  31. Syncing disks.
  32. [root@server0 ~]# partprobe
  33. [root@server0 ~]# mkswap /dev/vdb2
  34. Setting up swapspace version , size = KiB
  35. no label, UUID=b9a7e4a8-66f9-4de0-8d3e-f09a7844fa69
  36. [root@server0 ~]# swapon -av /dev/vdb2
  37. swapon /dev/vdb2
  38. swapon: /dev/vdb2: found swap signature: version , page-size , same byte order
  39. swapon: /dev/vdb2: pagesize=, swapsize=, devsize=
  40. [root@server0 ~]# echo "UUID=b9a7e4a8-66f9-4de0-8d3e-f09a7844fa69 swap swap defults 0 0">>/etc/fstab
  41. [root@server0 ~]# mount -av
  42. / : ignored
  43. /mnt/lvm : already mounted
  44. swap : ignored

[root@server0 ~]# free -lh | grep Swap
  Swap:     511M      0B           511M
  [root@server0 ~]#

  1.  

十六、查找文件

  • 请把系统上拥有者为jay用户的所有文件,拷贝到/root/findfiles目录中

解题:

  1. [root@server0 ~]# mkdir /root/findfiles -p
  2. [root@server0 ~]# find / -user jay -exec cp -a {} /root/findfiles/ \;
  3. find: ‘/proc//task//fd/’: No such file or directory
  4. find: ‘/proc//task//fdinfo/’: No such file or directory
  5. find: ‘/proc//fd/’: No such file or directory
  6. find: ‘/proc//fdinfo/’: No such file or directory
  7. find: ‘/home/guests/ldapuser0’: Permission denied
  8. cp: cannot overwrite non-directory ‘/root/findfiles/jay with directory ‘/home/jay
  9. [root@server0 ~]# ls -l /root/findfiles/
  10. total
  11. drwxr-xr-x. jay jay Jan extensions
  12. -rw-r--r--. jay jay Jul gnome-initial-setup-done
  13. -rw-rw----. jay mail Dec : jay
  14. -rw-r--r--. jay jay Jul monitors.xml
  15. drwxr-xr-x. jay jay Jan plugins
  16. [root@server0 ~]#

十七、查找一个字符串

• 把/usr/share/dict/words文件中包含seismic字符串的行找到,并将这些行按照原始文件中的顺序存放到/root/wordlist中。
• /root/wordlist文件不能包含空行。

解题:

  1. [root@server0 ~]# grep seismic /usr/share/dict/words | grep -v ^$ >/root/wordlist

https://www.cnblogs.com/tanshouke/p/12186366.html

注:原创帖,转载需注明出处


下一篇:RHCE考试:https://www.cnblogs.com/tanshouke/p/12187419.html

RHCSA考试(Linux7)的更多相关文章

  1. RHCSA考试真题

    2018年 RHCSA考试真题... ------------ 考前需要做的基础 破解root密码 KVM虚拟机与VM虚拟机 主机名:station.domain1.example.comIP地址:1 ...

  2. 模拟RHCSA考试环境

    转载自 http://blog.51cto.com/10681635/2084794 模拟RHCSA考试环境 第1章  修改 root 密码 第2章  配置网络 第3章  设定SeLinux 第4章  ...

  3. RHCSA考试

      RHCSA_PDF版传送门:https://files.cnblogs.com/files/zhangjianghua/RHCSA%E8%AF%95%E9%A2%98.pdf RHCE_PDF版传 ...

  4. RHCE考试(Linux7)

    博主本人平和谦逊,热爱学习,读者阅读过程中发现错误的地方,请帮忙指出,感激不尽 一.环境模拟 * server0.example.com :172.25.0.11 * desktop0.example ...

  5. 红帽RHEL7版本RHCE认证学习及考试经历

    RHCE是红帽公司推出的Linux系统的中级认证,考试全部采取上机形式,在考察考生的基础理论知识的同时还能考察实践动手操作能力,在Linux领域的价值是不可否认的,所以对于期望从事相关行业的同学们在上 ...

  6. Red Hat Linux认证

    想系统的学习一下Linux,了解了一些关于Red Hat Linux认证的信息.整理如下. 当前比较常见的是RHCE认证,即Red Hat Certified Engineer.最高级别的是RHCA ...

  7. RHCE认证考前辅导

    一一:Linux认证题库详细说明 注意事项 (1) RHCSA上午2.5小时,RHCE下午3.5小时,考生需对题目非常熟练. (2) 5样东西必带(身份证.1支黑色水笔.常用邮箱.姓名拼音.聪明的脑袋 ...

  8. 《linux就该这么学》第三节课 第二节命令笔记

    命令笔记 (随笔原创,借鉴请修改) linux系统中一切都是文件 2.4  系统状态的命令:  ifconfig   :    查看系统网卡信息,包括网卡名称,ip地址,掩码,mac地址,收到数据包大 ...

  9. 考取RHCE认证的历程,总结的经验

    昨天去考试的,今天下午结果出来了,达到了我的预期.成功的获取了RHCE认证,以后我也是有证的人咯~,开个玩笑. 其实去年的时候我就曾经想要去考取的,我原来一直以为考取RHCE认证时考题都是英文的呢?因 ...

随机推荐

  1. 给adobe acrobat reader 添加图片注释

    首先展示一下  我添加注释的结果, 下面是我的做法: 在Adobe Acrobat 中打开Sample.pdf文档,点开文档右边的“工具”-“内容”-选择“编辑对象”,鼠标光标变成实心箭头+右下角小方 ...

  2. 实现3d效果

    transform-origin: center left 60px;可以实现3d转换

  3. rpc框架解释

    远程过程调用协议RPC(Remote Procedure Call Protocol) RPC是指远程过程调用,也就是说两台服务器A,B,一个应用部署在A服务器上,想要调用B服务器上应用提供的函数/方 ...

  4. sourceTree 代码回滚(git 和http)

    近些时候,有遇到提交后代码有误的情况,所以需要回退到前一个版本.因为不常见,所以每次都不是很熟练,记录于此,以备查阅. 一.[将master重置到这次提交] 在sourceTree中选中错误的提交的下 ...

  5. 吴裕雄--天生自然ShellX学习笔记:Shell简介

    Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁.Shell 既是一种命令语言,又是一种程序设计语言. Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个 ...

  6. 吴裕雄--天生自然 JAVA开发学习:基本数据类型

    public class PrimitiveTypeTest { public static void main(String[] args) { // byte System.out.println ...

  7. mybatis 在自动生成时设置不生成Example类

    只需要在配置要生成的table表中添加几个配置属性就行了. 在generatorConfig.xml文件中修改 <!--指定数据库表--> <table tableName=&quo ...

  8. MyBatis从入门到精通(第9章):Spring集成MyBatis(中)

    MyBatis从入门到精通(第9章):Spring集成MyBatis(中) 框架(Framework)是整个或部分系统的可重用设计,表现为一组抽象构件及构件实例间交互的方法.应该将应用自身的设计和具体 ...

  9. 你需要知道的 N 种抓取 dump 的工具

    原总结注册表debug调试dump转储文件windbgprocdump 前言 今天,向大家介绍几种可以抓取应用程序转储文件的工具及基本使用方法.更详细的用法,请参考每个工具对应的帮助文档.如果你还不清 ...

  10. LGOJ1344 追查坏牛奶

    Description link 题意概述:给一张图,每条边有边权,求让点 \(1\) 和点 \(n\) 不连通的"最小破坏边权和" 和 "在此基础上的最小破坏边数&qu ...