| Chapter 1: Foundations of Kali Linux




Download 22,59 Mb.
Pdf ko'rish
bet32/225
Sana14.05.2024
Hajmi22,59 Mb.
#232856
1   ...   28   29   30   31   32   33   34   35   ...   225
Bog'liq
learningkalilinux

26 | Chapter 1: Foundations of Kali Linux


Administrative Privileges for Services
Services are system-level. Managing them requires administrative
privileges. Either you need to be root or you need to use 
sudo
to
gain temporary root privileges in order to perform the service
management functions.
For a long time, many Linux distributions used the AT&T 
init
startup process. This
meant that services were run with a set of scripts that took standard parameters. The
init
startup system used runlevels to determine which services started. Single-user
mode would start up a different set of services than multiuser mode. Even more serv‐
ices would be started up when a display manager is being used, to provide GUIs to
users. The scripts were stored in 
/etc/init.d/
and could be managed by providing
parameters such as 
start

stop

restart
, and 
status
. As an example, if you wanted to
start the SSH service, you might use the command 
/etc/init.d/ssh start
. The problem
with the 
init
system, though, was that it was generally serial in nature. This caused
performance issues on system startup because every service would be started in
sequence rather than multiple services starting at the same time. The other problem
with the 
init
system was that it didn’t support dependencies well. Often, one service
may rely on other services that had to be started first.
Along comes 
systemd
, which was developed by software developers at RedHat. The
goal of 
systemd
was to improve the efficiency of the 
init
system and overcome some of
its shortcomings. Services can declare dependencies, and services can start in parallel.
There is no longer a need to write bash scripts to start up the services. Instead, there
are configuration files, and all service management is handled with the program 
sys‐
temctl
. To manage a service using 
systemctl
, you would use 
systemctl verb service
,
where 
verb
is the command you are passing and 
service
is the name of the service. As
an example, if you wanted to enable the SSH service and then start it, you would issue
the commands in 
Example 1-5
.
Example 1-5. Enabling and starting SSH service
root@rosebud:~# systemctl 
enable 
ssh
Synchronizing state of ssh.service with SysV service script with
/lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install 
enable 
ssh
root@rosebud:~# systemctl start ssh
The first thing we do is enable the service: you are telling your system that when you
boot, you want this service to start. The different system startup modes that the ser‐
vice will start in are configured in the configuration file associated with the service.
Every service has a configuration file. Instead of runlevels, as the old 
init
system used,
systemd
uses targets. A 
target
is essentially the same as a runlevel, in that it indicates a

Download 22,59 Mb.
1   ...   28   29   30   31   32   33   34   35   ...   225




Download 22,59 Mb.
Pdf ko'rish