Booting, Targets, Services Flashcards
Where are targets located?
/etc/systemd/system *called first
/usr/lib/systemd/system
What are ways to shutdown?
shutdown -h shutdown -r shutdown -P shutdown +3 *3 minutes *calls systemctl shutdown
How do you find available targets on a system?
systemctl list-units –type=target
How do you find the different types of unit configuration files on a system?
systemctl -t help
*type
How do you find dependencies of a target?
systemctl list-dependencies
i.e systemctl list-dependencies multi-user.target
How do you get the default target?
systemctl get-default
What is the multi-user.target?
Multiple users can be logged into the system (generally command line)
What is the graphical.target?
GUI interface
What is the emergency.target?
Boots into root user, mounts file system as read only
What is the rescue.target?
Boots into single user environment for troubleshooting system
What is a target?
A type of unit configuration file, grouping of dependencies for services, components
*another example is service
How do you change the target you are in?
systemctl isolate
i. e systemctl isolate multi-user.target
* target has to be configured to move in and out of it
Hoe do you set the default target at boot?
systemctl set-default
How do you change the target within GRUB?
e *edit the kernel configuration
on linux16-vmlinuz- line append: systemd.unit=
i.e systemd.unit=multi-user.target
How would you gain access to a system if the root password is forgotten?
Within GRUB e *edit the kernel configuration
on linux16-vmlinuz- line append: rd.break
Once entered into initramfs how would you change a password?
mount -oremount,rw /sysroot *remount as read/write as it is currently write
chroot /sysroot *mount /sysroot as new root directory
passwd
touch /.autorelabel *SELinux relabels all files at next boot because the context of SELinux was changed
*contents of sysroot are to be mounted as root during final boot process
How would you restart the network service?
systemctl restart network.service
How do you check if a service is enabled?
systemctl is-enabled
i. e systemctl is-enabled sshd
* if .service is not specified it is assumed by default
How do you view all disabled/enabled settings of all units?
systemctl list-unit-files –all
How do you enable/disable a service?
systemctl enable {service}
systemctl disable {service}
How do you start/stop a service?
systemctl start {service}
systemctl stop {service}