RHCSA考试(Linux7)
博主本人平和谦逊,热爱学习,读者阅读过程中发现错误的地方,请帮忙指出,感激不尽
文章说明:本文是作者原创,请尊重个人劳动成果,转载需注明出处,博主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.修改密码
- 按“e”进入编辑模式
- 在utf-8后面添加空格 rd.break
- Ctrl + x执行
- 以读写权限重新挂载硬盘上的真实系统根目录:
- mount -o remount,rw / /sysroot
- 切换至真实系统根目录:
- chroot /sysroot
- 按要求修改root密码:
- echo 123456 | passwd --stdin root
- 重新打标:
- touch /.autorelabel
- 退出真实系统:
- exit
- 退出系统重新引导:
- exit
- 以新密码登录系统
1.2.设置主机名
- [root@server0 ~]# hostnamectl set-hostname server0.example.com
- [root@server0 ~]# bash
- [root@server0 ~]# hostname
- server0.example.com
- [root@server0 ~]#
1.3.设置网络
- [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
- [root@server0 ~]# nmcli connection reload
- [root@server0 ~]# service network restart
- Restarting network (via systemctl): [ OK ]
- [root@server0 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- BOOTPROTO=none
- ONBOOT=yes
- TYPE=Ethernet
- USERCTL=yes
- IPV6INIT=no
- NAME=eth0
- PERSISTENT_DHCLIENT=
- IPADDR0=172.25.0.11
- PREFIX0=
- GATEWAY0=172.25.0.254
- DNS1=172.25.254.254
- DOMAIN=server0.example.com
- DEFROUTE=yes
- IPV4_FAILURE_FATAL=no
- UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
- [root@server0 ~]#
二、设置SELinux
请保证系统 SELinux 运行在 Enforcing 状态,要求系统重启仍然生效
解题:
- [root@server0 ~]# setenforce 1
- [root@server0 ~]# getenforce
- Enforcing
- [root@server0 ~]#
[root@server0 ~]# vim /etc/selinux/config
[root@server0 ~]# reboot
三、配置yum源
配置你的本地默认 YUM 仓库指向 http://classroom.example.com/content/rhel7.0/x86_64/dvd
解题:
- [root@server0 ~]# yum-config-manager --help | grep add
- --downloaddir=DLDIR
- --add-repo=ADDREPO add (and enable) the repo from the specified file or
- [root@server0 ~]# yum-config-manager --add-repo="http://classroom.example.com/content/rhel7.0/x86_64/dvd/"
- Loaded plugins: langpacks
- adding repo from: http://classroom.example.com/content/rhel7.0/x86_64/dvd/
- [classroom.example.com_content_rhel7.0_x86_64_dvd_]
- name=added from: http://classroom.example.com/content/rhel7.0/x86_64/dvd/
- baseurl=http://classroom.example.com/content/rhel7.0/x86_64/dvd/
- enabled=
- [root@server0 ~]# echo "gpgcheck=0">>/etc/yum.repos.d/classroom.example.com_content_rhel7.0_x86_64_dvd_.repo
- [root@server0 ~]# yum clean all
- Loaded plugins: langpacks
- Cleaning repos: classroom.example.com_content_rhel7.0_x86_64_dvd_ rhel_dvd
- Cleaning up everything
- [root@server0 ~]# yum makecache
- Loaded plugins: langpacks
- classroom.example.com_content_rhel7.0_x86_64_dvd_ | 4.1 kB ::
- rhel_dvd | 4.1 kB ::
- (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/group_gz | kB ::
- (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/primary_db | 3.4 MB ::
- (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/other_db | 1.3 MB ::
- (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/productid | 1.6 kB ::
- (/): classroom.example.com_content_rhel7.0_x86_64_dvd_/filelists_db | 3.0 MB ::
- (/): rhel_dvd/group_gz | kB ::
- (/): rhel_dvd/primary_db | 3.4 MB ::
- (/): rhel_dvd/other_db | 1.3 MB ::
- (/): rhel_dvd/filelists_db | 3.0 MB ::
- Metadata Cache Created
- [root@server0 ~]# yum repolist
- Loaded plugins: langpacks
- repo id repo name status
- classroom.example.com_content_rhel7.0_x86_64_dvd_ added from: http://classroom.example.com/content/ 4,305
- rhel_dvd Remote classroom copy of dvd ,
- repolist: ,
- [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
- [root@server0 ~]# fdisk /dev/vdb
- Welcome to fdisk (util-linux 2.23.).
- 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
- Building a new DOS disklabel with disk identifier 0x095042ab.
- Command (m for help): p
- Disk /dev/vdb: 10.7 GB, bytes, sectors
- Units = sectors of * = bytes
- Sector size (logical/physical): bytes / bytes
- I/O size (minimum/optimal): bytes / bytes
- Disk label type: dos
- Disk identifier: 0x095042ab
- Device Boot Start End Blocks Id System
- Command (m for help): n
- Partition type:
- p primary ( primary, extended, free)
- e extended
- Select (default p): e
- Partition number (-, default ):
- First sector (-, default ):
- Using default value
- Last sector, +sectors or +size{K,M,G} (-, default ): +1G
- Partition of type Extended and of size GiB is set
- Command (m for help): n
- Partition type:
- p primary ( primary, extended, free)
- l logical (numbered from )
- Select (default p): l
- Adding logical partition
- First sector (-, default ):
- Using default value
- Last sector, +sectors or +size{K,M,G} (-, default ):
- Using default value
- Partition of type Linux and of size MiB is set
- Command (m for help): t
- Partition number (,, default ):
- Hex code (type L to list all codes): 8e
- Changed type of partition 'Linux' to 'Linux LVM'
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- Syncing disks.
- [root@server0 ~]# partprobe
- [root@server0 ~]#
4.2.按要求添加逻辑卷
- [root@server0 ~]# pvcreate /dev/vdb5
- Physical volume "/dev/vdb5" successfully created
- [root@server0 ~]# vgcreate --help | grep size
- [-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]]
- [root@server0 ~]# vgcreate vg0 -s 16M /dev/vdb5
- Volume group "vg0" successfully created
- [root@server0 ~]# vgdisplay
- --- Volume group ---
- VG Name vg0
- System ID
- Format lvm2
- Metadata Areas
- Metadata Sequence No
- VG Access read/write
- VG Status resizable
- MAX LV
- Cur LV
- Open LV
- Max PV
- Cur PV
- Act PV
- VG Size 1008.00 MiB
- PE Size 16.00 MiB
- Total PE
- Alloc PE / Size /
- Free PE / Size / 1008.00 MiB
- VG UUID jvZd9h-nV9v-ankV-skjP-btgB-vF8R-W67IRT
- [root@server0 ~]# lvcreate -n lv0 -l 16 vg0
- Logical volume "lv0" created
- [root@server0 ~]# lvdisplay
- --- Logical volume ---
- LV Path /dev/vg0/lv0
- LV Name lv0
- VG Name vg0
- LV UUID n8oBJF-9caQ-COg8-2peS-pWTz-mQDj-rXHUKL
- LV Write Access read/write
- LV Creation host, time server0.example.com, -- :: +
- LV Status available
- # open
- LV Size 256.00 MiB
- Current LE
- Segments
- Allocation inherit
- Read ahead sectors auto
- - currently set to
- Block device :
- [root@server0 ~]# mkfs.xfs /dev/vg0/lv0
- meta-data=/dev/vg0/lv0 isize= agcount=, agsize= blks
- = sectsz= attr=, projid32bit=
- = crc=
- data = bsize= blocks=, imaxpct=
- = sunit= swidth= blks
- naming =version bsize= ascii-ci= ftype=
- log =internal log bsize= blocks=, version=
- = sectsz= sunit= blks, lazy-count=
- realtime =none extsz= blocks=, rtextents=
- [root@server0 ~]#
4.3.设置自动挂载
- [root@server0 ~]# mkdir -p /mnt/lvm
- [root@server0 ~]# blkid
- /dev/vda1: UUID="9bf6b9f7-92ad-441b-848e-0257cbb883d1" TYPE="xfs"
- /dev/vdb5: UUID="KydhrK-3Nar-ktHy-b6Gq-skNj-sIQu-MgWCmm" TYPE="LVM2_member"
- /dev/mapper/vg0-lv0: UUID="11ddc813-2a94-46f7-a7de-e735eb8bfe8c" TYPE="xfs"
- [root@server0 ~]# echo "UUID="11ddc813-2a94-46f7-a7de-e735eb8bfe8c" /mnt/lvm xfs defaults 0 0">>/etc/fstab
- [root@server0 ~]# mount -av
- / : ignored
- mount: /mnt/lvm does not contain SELinux labels.
- You just mounted an file system that supports labels which does not
- contain labels, onto an SELinux box. It is likely that confined
- applications will generate AVC messages and not be allowed access to
- this file system. For more details see restorecon() and mount().
- /mnt/lvm : successfully mounted
- [root@server0 ~]# df -lh | grep lv0
- /dev/mapper/vg0-lv0 253M 13M 240M % /mnt/lvm
- [root@server0 ~]#
4.4.扩容
- [root@server0 ~]# lvextend -L 384M /dev/vg0/lv0
- Extending logical volume lv0 to 384.00 MiB
- Logical volume lv0 successfully resized
- [root@server0 ~]# xfs_growfs /dev/vg0/lv0
- meta-data=/dev/mapper/vg0-lv0 isize= agcount=, agsize= blks
- = sectsz= attr=, projid32bit=
- = crc=
- data = bsize= blocks=, imaxpct=
- = sunit= swidth= blks
- naming =version bsize= ascii-ci= ftype=
- log =internal bsize= blocks=, version=
- = sectsz= sunit= blks, lazy-count=
- realtime =none extsz= blocks=, rtextents=
- data blocks changed from to
- [root@server0 ~]# df -lh | grep lv0
- /dev/mapper/vg0-lv0 381M 14M 368M % /mnt/lvm
- [root@server0 ~]#
五、按照以下要求创建用户、组
• 新建一个名为adminuser的组,id为40000
• 新建一个natasha的用户,并将adminuser作为其附属组
• 新建一个harry用户,并将adminuser作为其附属组
• 新建一个sarah的用户,其不属于adminuser组,在系统送没有任何可交互的shell
• natasha、harry、和sarah三个用户的密码均设为rehat
解题:
- [root@server0 ~]# groupadd --help | grep id
- -g, --gid GID use GID for the new group
- -K, --key KEY=VALUE override /etc/login.defs defaults
- [root@server0 ~]# groupadd -g 40000 adminuser
- [root@server0 ~]# cat /etc/group | grep 4000
- adminuser:x::
- [root@server0 ~]# useradd --help | grep group
- -g, --gid GROUP name or ID of the primary group of the new
- -G, --groups GROUPS list of supplementary groups of the new
- -N, --no-user-group do not create a group with the same name as
- -U, --user-group create a group with the same name as the user
- [root@server0 ~]# useradd -G adminuser natasha
- [root@server0 ~]# useradd -G adminuser harry
- [root@server0 ~]# useradd --help | grep shell
- -s, --shell SHELL login shell of the new account
- [root@server0 ~]# useradd -s /sbin/nologin sarah
- [root@server0 ~]# cat /etc/passwd | grep sarah
- sarah:x::::/home/sarah:/sbin/nologin
- [root@server0 ~]# echo rehat | passwd --stdin natasha
- Changing password for user natasha.
- passwd: all authentication tokens updated successfully.
- [root@server0 ~]# echo rehat | passwd --stdin harry
- Changing password for user harry.
- passwd: all authentication tokens updated successfully.
- [root@server0 ~]# echo rehat | passwd --stdin sarah
- Changing password for user sarah.
- passwd: all authentication tokens updated successfully.
- [root@server0 ~]#
六、配置文件权限
• 该文件的所属组为root
• 该文件的所属人为root
• 该文件对任何人均没有执行权限
• 用户natasha对该文件有读和写权限
• 用户harry对该文件既不能读也不能写
• 所有用户(包括当前用户和未来创建的用户)对该文件都有读的权限
解题:
- [root@server0 ~]# cp -a /etc/fstab /var/tmp/
- [root@server0 ~]# chown root:root /var/tmp/fstab
- [root@server0 ~]# chmod a-x /var/tmp/fstab
- [root@server0 ~]# setfacl -Rm u:natasha:rw,u:harry:-- /var/tmp/fstab
- [root@server0 ~]# chmod a+r /var/tmp/fstab
- [root@server0 ~]# getfacl /var/tmp/fstab
- getfacl: Removing leading '/' from absolute path names
- # file: var/tmp/fstab
- # owner: root
- # group: root
- user::rw-
- user:natasha:rw-
- user:harry:---
- group::r--
- mask::rw-
- other::r--
- [root@server0 ~]#
七、建立计划任务
• 对natasha用户建立计划任务,要求在本地时间的每天14:23执行 /bin/echo "rhcsa" 命令
- [root@server0 ~]# crontab -e -u natasha
- [root@server0 ~]# crontab -l -u natasha
- # mim hour day month week command
- * * * /bin/echo "rhcsa"
- [root@server0 ~]#
八、创建共享目录
• /home/admins目录的所属组为adminuser
• 该目录对adminuser组的成员可读可写可执行,但是对其它用户没有任何权限,但是root不受限制
• 在/home/admins目录下创建的文件所属组自动被设置为adminuser
解题:
- [root@server0 ~]# mkdir /home/admins
- [root@server0 ~]# chgrp adminuser /home/admins/
- [root@server0 ~]# chmod g=rwx,o=-- /home/admins/
- [root@server0 ~]# chmod g+s /home/admins/
- [root@server0 ~]# ls -ld /home/admins/
- drwxrws---. root adminuser Dec : /home/admins/
- [root@server0 ~]# getfacl /home/admins/
- getfacl: Removing leading '/' from absolute path names
- # file: home/admins/
- # owner: root
- # group: adminuser
- # flags: -s-
- user::rwx
- group::rwx
- other::---
- [root@server0 ~]#
九、升级系统内核
• 当系统重新启动之后,升级的内核要作为默认的内核
• 原来的内核要被保留,并且仍然可以正常启动
• A 新内核的 RPM 包在http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages
注意事项:使用连接的时候一定要在连接尾部添加“/”
解题:
- [root@server0 ~]# curl -s http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/ | grep kernel
- <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...></a></td><td align="right">-- : </td><td align="right"> 29M</td><td> </td></tr>
- <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.-..></a></td><td align="right">-- : </td><td align="right"> 12M</td><td> </td></tr>
- [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
- ---- ::-- http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-123.1.2.el7.x86_64.rpm
- Resolving classroom.example.com (classroom.example.com)... 172.25.254.254
- Connecting to classroom.example.com (classroom.example.com)|172.25.254.254|:... connected.
- HTTP request sent, awaiting response... OK
- Length: (29M) [application/x-rpm]
- Saving to: ‘kernel-3.10.-123.1..el7.x86_64.rpm’
- %[=================================================>] ,, .1MB/s in .4s
- -- :: (82.1 MB/s) - ‘kernel-3.10.-123.1..el7.x86_64.rpm’ saved [/]
- [root@server0 ~]# ls
- anaconda-ks.cfg Documents kernel-3.10.0-123.1.2.el7.x86_64.rpm Pictures Templates
- Desktop Downloads Music Public Videos
- [root@server0 ~]# chmod 755 kernel-3.10.0-123.1.2.el7.x86_64.rpm
- [root@server0 ~]# rpm -ivh kernel-3.10.0-123.1.2.el7.x86_64.rpm
- warning: kernel-3.10.-123.1..el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
- Preparing... ################################# [%]
- Updating / installing...
- :kernel-3.10.-123.1..el7 ################################# [%]
- [root@server0 ~]# grub2-editenv list
- saved_entry=Red Hat Enterprise Linux Server (3.10.-123.1..el7.x86_64) 7.0 (Maipo)
- [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.安装必备软件
- [root@server0 ~]# yum install authconfig-gtk sssd krb5-workstation -y
- [root@server0 ~]# authconfig-gtk
10.2.配置LDAP
- 上面配置完成再进行(没有配置的话sssd服务无法启动):
- [root@server0~]# systemctl enable sssd
- [root@server0~]# systemctl restart sssd
- [root@server0~]# systemctl status sssd
- [root@server0~]# su ldapuser0
- bash-4.2$
- 验证用户: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 ~]#
十一、配置autofs
- classroom.example.com 使用 NFS 共享了/home/guests 给你的系统。这个文件系统包含了预先设置好的用户 ldapuser0 的家目录;
- ldapuser0 的家目录是 classroom.example.com:/home/guests/ldapuser0 ;
- ldapuser0 的家目录应该自动挂载到本地的 /home/guests/ldapuser0 家目录必须对用户具有可写权限;
- ldapuser0 的密码是 'kerberos’
解题:
11.1.安装软件
- [root@server0 ~]# yum install autofs -y
- [root@server0 ~]# systemctl enable autofs.service
11.2.设置挂载
- [root@server0 ~]# cp -a /etc/auto.misc /etc/auto.aa
- [root@server0 ~]# echo "/home/guests /etc/auto.aa" >>/etc/auto.master
- [root@server0 ~]# echo "* -type=nfs,rw classroom.example.com:/home/guests/&">>/etc/auto.aa
- [root@server0 ~]# systemctl restart autofs.service
- [root@server0 ~]# ssh ldapuser0@localhost
- ldapuser0@localhost's password: (kerberos)
- Last login: Wed Dec :: from localhost
- [ldapuser0@server0 ~]$ cd /home/guests/
- [ldapuser0@server0 guests]$ ls
- ldapuser0
- [ldapuser0@server0 guests]$
十二、配置NTP
配置你的系统时间与服务器 classroom.example.com 同步
解题:
12.1.如图
12.2.设置开机启动
- [root@server0 ~]# systemctl enable chronyd
- [root@server0 ~]# systemctl restart chronyd.service
- [root@server0 ~]# chronyc sources -v
- Number of sources =
- .-- Source mode '^' = server, '=' = peer, '#' = local clock.
- / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
- | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
- || .- xxxx [ yyyy ] +/- zzzz
- || / xxxx = adjusted offset,
- || Log2(Polling interval) -. | yyyy = measured offset,
- || \ | zzzz = estimated error.
- || | |
- MS Name/IP address Stratum Poll Reach LastRx Last sample
- ===============================================================================
- ^* classroom.example.com +796ns[ -21us] +/- 1176us
- [root@server0 ~]#
十三、创建归档
• 创建一个名为 /root/sysconfig.tar.bz2的归档文件,其中包含了/etc/sysconfig目录中的内容。tar归档文件
必须使用bzip2进行压缩。
解题:
- [root@server0 ~]# man tar | grep zip2
- -j, --bzip2
- filter the archive through bzip2
- -j, --bzip2
- filter the archive through bzip2
- [root@server0 ~]# tar -jcf /root/sysconfg.tar.bz2 /etc/sysconfig/
十四、创建一个用户
- 用户id=3456 用户名:jay
- 密码为:glegunle
解题:
- [root@server0 ~]# useradd -u 3456 jay
- [root@server0 ~]# echo "glegunge"|passwd --stdin jay
- Changing password for user jay.
- passwd: all authentication tokens updated successfully.
- [root@server0 ~]# id jay
- uid=(jay) gid=(jay) groups=(jay)
- [root@server0 ~]#
十五、添加swap分区
• swap分区的容量为512M
• 当您的系统启动时,swap分区可以自动挂载
• 不要移动或是修改其它已经存在于您的系统中的swap分区
解题:
- [root@server0 ~]# fdisk /dev/vdb
- Welcome to fdisk (util-linux 2.23.).
- Changes will remain in memory only, until you decide to write them.
- Be careful before using the write command.
- Command (m for help): n
- Partition type:
- p primary ( primary, extended, free)
- l logical (numbered from )
- Select (default p): p
- Partition number (-, default ):
- First sector (-, default ):
- Using default value
- Last sector, +sectors or +size{K,M,G} (-, default ): +512M
- Partition of type Linux and of size MiB is set
- Command (m for help): t
- Partition number (,,, default ):
- Hex code (type L to list all codes):
- Changed type of partition 'Linux' to 'Linux swap / Solaris'
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- WARNING: Re-reading the partition table failed with error : Device or resource busy.
- The kernel still uses the old table. The new table will be used at
- the next reboot or after you run partprobe() or kpartx()
- Syncing disks.
- [root@server0 ~]# partprobe
- [root@server0 ~]# mkswap /dev/vdb2
- Setting up swapspace version , size = KiB
- no label, UUID=b9a7e4a8-66f9-4de0-8d3e-f09a7844fa69
- [root@server0 ~]# swapon -av /dev/vdb2
- swapon /dev/vdb2
- swapon: /dev/vdb2: found swap signature: version , page-size , same byte order
- swapon: /dev/vdb2: pagesize=, swapsize=, devsize=
- [root@server0 ~]# echo "UUID=b9a7e4a8-66f9-4de0-8d3e-f09a7844fa69 swap swap defults 0 0">>/etc/fstab
- [root@server0 ~]# mount -av
- / : ignored
- /mnt/lvm : already mounted
- swap : ignored
[root@server0 ~]# free -lh | grep Swap
Swap: 511M 0B 511M
[root@server0 ~]#
十六、查找文件
- 请把系统上拥有者为jay用户的所有文件,拷贝到/root/findfiles目录中
解题:
- [root@server0 ~]# mkdir /root/findfiles -p
- [root@server0 ~]# find / -user jay -exec cp -a {} /root/findfiles/ \;
- find: ‘/proc//task//fd/’: No such file or directory
- find: ‘/proc//task//fdinfo/’: No such file or directory
- find: ‘/proc//fd/’: No such file or directory
- find: ‘/proc//fdinfo/’: No such file or directory
- find: ‘/home/guests/ldapuser0’: Permission denied
- cp: cannot overwrite non-directory ‘/root/findfiles/jay’ with directory ‘/home/jay’
- [root@server0 ~]# ls -l /root/findfiles/
- total
- drwxr-xr-x. jay jay Jan extensions
- -rw-r--r--. jay jay Jul gnome-initial-setup-done
- -rw-rw----. jay mail Dec : jay
- -rw-r--r--. jay jay Jul monitors.xml
- drwxr-xr-x. jay jay Jan plugins
- [root@server0 ~]#
十七、查找一个字符串
• 把/usr/share/dict/words文件中包含seismic字符串的行找到,并将这些行按照原始文件中的顺序存放到/root/wordlist中。
• /root/wordlist文件不能包含空行。
解题:
- [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)的更多相关文章
- RHCSA考试真题
2018年 RHCSA考试真题... ------------ 考前需要做的基础 破解root密码 KVM虚拟机与VM虚拟机 主机名:station.domain1.example.comIP地址:1 ...
- 模拟RHCSA考试环境
转载自 http://blog.51cto.com/10681635/2084794 模拟RHCSA考试环境 第1章 修改 root 密码 第2章 配置网络 第3章 设定SeLinux 第4章 ...
- RHCSA考试
RHCSA_PDF版传送门:https://files.cnblogs.com/files/zhangjianghua/RHCSA%E8%AF%95%E9%A2%98.pdf RHCE_PDF版传 ...
- RHCE考试(Linux7)
博主本人平和谦逊,热爱学习,读者阅读过程中发现错误的地方,请帮忙指出,感激不尽 一.环境模拟 * server0.example.com :172.25.0.11 * desktop0.example ...
- 红帽RHEL7版本RHCE认证学习及考试经历
RHCE是红帽公司推出的Linux系统的中级认证,考试全部采取上机形式,在考察考生的基础理论知识的同时还能考察实践动手操作能力,在Linux领域的价值是不可否认的,所以对于期望从事相关行业的同学们在上 ...
- Red Hat Linux认证
想系统的学习一下Linux,了解了一些关于Red Hat Linux认证的信息.整理如下. 当前比较常见的是RHCE认证,即Red Hat Certified Engineer.最高级别的是RHCA ...
- RHCE认证考前辅导
一一:Linux认证题库详细说明 注意事项 (1) RHCSA上午2.5小时,RHCE下午3.5小时,考生需对题目非常熟练. (2) 5样东西必带(身份证.1支黑色水笔.常用邮箱.姓名拼音.聪明的脑袋 ...
- 《linux就该这么学》第三节课 第二节命令笔记
命令笔记 (随笔原创,借鉴请修改) linux系统中一切都是文件 2.4 系统状态的命令: ifconfig : 查看系统网卡信息,包括网卡名称,ip地址,掩码,mac地址,收到数据包大 ...
- 考取RHCE认证的历程,总结的经验
昨天去考试的,今天下午结果出来了,达到了我的预期.成功的获取了RHCE认证,以后我也是有证的人咯~,开个玩笑. 其实去年的时候我就曾经想要去考取的,我原来一直以为考取RHCE认证时考题都是英文的呢?因 ...
随机推荐
- 给adobe acrobat reader 添加图片注释
首先展示一下 我添加注释的结果, 下面是我的做法: 在Adobe Acrobat 中打开Sample.pdf文档,点开文档右边的“工具”-“内容”-选择“编辑对象”,鼠标光标变成实心箭头+右下角小方 ...
- 实现3d效果
transform-origin: center left 60px;可以实现3d转换
- rpc框架解释
远程过程调用协议RPC(Remote Procedure Call Protocol) RPC是指远程过程调用,也就是说两台服务器A,B,一个应用部署在A服务器上,想要调用B服务器上应用提供的函数/方 ...
- sourceTree 代码回滚(git 和http)
近些时候,有遇到提交后代码有误的情况,所以需要回退到前一个版本.因为不常见,所以每次都不是很熟练,记录于此,以备查阅. 一.[将master重置到这次提交] 在sourceTree中选中错误的提交的下 ...
- 吴裕雄--天生自然ShellX学习笔记:Shell简介
Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁.Shell 既是一种命令语言,又是一种程序设计语言. Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个 ...
- 吴裕雄--天生自然 JAVA开发学习:基本数据类型
public class PrimitiveTypeTest { public static void main(String[] args) { // byte System.out.println ...
- mybatis 在自动生成时设置不生成Example类
只需要在配置要生成的table表中添加几个配置属性就行了. 在generatorConfig.xml文件中修改 <!--指定数据库表--> <table tableName=&quo ...
- MyBatis从入门到精通(第9章):Spring集成MyBatis(中)
MyBatis从入门到精通(第9章):Spring集成MyBatis(中) 框架(Framework)是整个或部分系统的可重用设计,表现为一组抽象构件及构件实例间交互的方法.应该将应用自身的设计和具体 ...
- 你需要知道的 N 种抓取 dump 的工具
原总结注册表debug调试dump转储文件windbgprocdump 前言 今天,向大家介绍几种可以抓取应用程序转储文件的工具及基本使用方法.更详细的用法,请参考每个工具对应的帮助文档.如果你还不清 ...
- LGOJ1344 追查坏牛奶
Description link 题意概述:给一张图,每条边有边权,求让点 \(1\) 和点 \(n\) 不连通的"最小破坏边权和" 和 "在此基础上的最小破坏边数&qu ...