未加星标

Fastest Way to Gain Root Access in RHCSA7 Exam

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二04 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

Time is at a premium during the RHCSA exam. Every minute you can save on a task is a minute as it can be applied to some other task. If you have to reboot the operating system, that is wasting time as you cannot be doing anything useful in terms of task completion during the reboot.

One critical task is to require you to gain root access to the installed and running operating system. This is typically the first thing you need to do in the exam. There are many blogs and write-ups on how to do this by modifying the linux kernel command line in GRUB including Certdepot and the RHEL7 System Administration Guide .

Typically they all require you to disable SELinux and break out of the early boot process via the following arguments on the kernel command line:

rd.break enforcing=0

and then relabel the entire operating system during a reboot via

# touch /.autorelabel

This is wasteful because of the time lost by rebooting and there is the slight possibility that the relabeling may take several minutes or longer to complete.

By the way, rd.break is not a GRUB command; it is a Dracut argument which tells Dracut to drop into a shell. The version of GRUB is also different than in previous versions of RHEL. It is what was formerly know as GRUB2. It is a seriously over-engineered and complex multiboot loader which uses a completely different command syntax than GRUB Legacy.

The method I demonstrate here does not require a second reboot and relabels only /etc/shadow since this is the only file whose security content is incorrect after you change the password for root . The net result of using this method is several minutes of time saved during the RHCSA exam.

First get to the GRUB command line by rebooting the operating system and add init=/bin/bash to the end of the GRUB command which starts with linux16 in the case of non-UEFI firmware or linuxefi in the case of UEFI -enabled firmware. By the way, linux16 means load the binary in 16-bit mode. UEFI does not have a 16 bit mode; hence the different GRUB commands. Do not bother removing the existing rhgb or quiet arguments unless you run into a problem while booting.


Fastest Way to Gain Root Access in RHCSA7 Exam

Then, as usual, press Ctrl-X to resume GRUB and the boot process. You will end up as root in a bash shell where you can change the root password, load the SELinux policy, relabel /etc/shadow and load the full operating system without rebooting a second time.


Fastest Way to Gain Root Access in RHCSA7 Exam

The command /sbin/load_policy -i loads the current security policy into the kernel. The command /sbin/restorecon restores the correct security context ( shadow_t ) to /etc/shadow . As shown above, you can use ls -lZ to display a file’s SELinux contexts, etc.

This is a critical RHCSA7 exam task. If you cannot take control of the RHEL7 operating system through a reboot at the beginning of the exam and change the root password, you will fail the entire exam. You need to repeatedly practice this task until you can do it reliably in about 3 minutes or less.

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: LinuxUB
分页:12
转载请注明
本文标题:Fastest Way to Gain Root Access in RHCSA7 Exam
本站链接:http://www.codesec.net/view/479870.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(43)