9 Services Flashcards

1
Q

services

A

interactive programs run in the background users can interact with

ex: web service users can interact with

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

daemons

A

noninteractive programs running on the system and don’t communicate with users

ex: httpd is required to make web service run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is systemd?

A

software suit that provides an init method/daemon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

improvements over SysVinit

A

support parallelization (starting programs at the same time). us Control Groups (cgroups) instead of PID for petter categorization and isolation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

systemd service commands of systemctl

systemctl {subcommand} {service}

A

start
stop
restart
enable
disable
status
mask -creates a sym link to /dev/null to prevent starting service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

unit vs unit files

A

the term unit describes a resource systemd knows how to manage

unit file defines how the unit must be manages by systemd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

/lib/systemd/system

A

house default unit files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

/etc/systemd/system

A

configurations managed here and changes to these files override settings default unit settings in /lib but it doesn’t overwrite the file with new configurations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

.service files directives

A

Before=
-this will start before any unit in this field
After=
-when multiple units are specified, this unit will start after any unit listed
Requires=
-Units listed will be started if possible, and the primary unit will fail if the units specified by Requires= fail to start
Wants=
-Units listed will be started if possible, but the primary unit will still launch even if the units specified by Wants= fail to start
Type=
-Configures the startup type for the service; Values include simple, exec, forking, oneshot, dbus, notify, and idle
User=
-Specifies the user under whose authority the service runs (usually root)
ExecStart=
-Executes commands along a specified absolute path upon startup to start a service
ExecStop=
-Executes commands along a specified absolute path upon shutdown to stop a service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Timer unit files directives

A

OnBootSec - (monotonic) time spanning from an even such as system startup
OnCalender - (realtime) time referenced from system clock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

OnCalender format for timer unit files

A

{day of the week: Fri} (Year-Month-Day) (Hour:Min:Sec) –>

  • --* ::*

*/ in a field of {clock time} - specifies whenever this amount of time passes (not the time of day) in clocks field containing this, the value associated and what after matches value execute
ex: :/30:00
in the minute field and associated value is 30 so at least every 30 min, and whatever is after

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

.mount unit files options

A

What=
-Absolute path to storage to mount
Where=
-Absolute path to mount point directory
Type=
-Define the filesystem type (optional)
Options=
-Any additional required options for the mount action

systemd unit files use dashes as a delimiter for paths when read

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

common .target unit files

A

default -The target to which the system boots by default

multi-user.target - Starts the enable services and the system to the CLI

graphical.target - Starts the enable services and the system to the GUI

network-online - Starts the specified network services, and delays the target until network service is established

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

systemctl get-default

A

display default target

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

systemctl isolate {graphical | multi-user}.target

A

swap system to graphical or multi-user target.

temporary?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

/etc/rsyslog.conf

A

main rsyslog configurations file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

/etc/rsyslog.d/50-default.conf

A

additional configurations r syslog file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

cron.error -/var/log/cron

A

logs all cron messages from error and upwards to /var/log/cron

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

/var/log/syslog
/var/log/messages

A

general system logs for 1. Debian 2. Red hat derivatives

Log location for rsyslog daemon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

/var/log/auth.log
/var/log/secure

A

authentication logs for 1. Debian 2. Red Hat derivatives

21
Q

/var/log/yum.log

A

logs YUM package management

22
Q

/var/log/httpd

A

dir for Apache webserver log information

23
Q

how to make a centralized server for rsyslogs where other servers will forward

A
  1. uncomment lines in the /etc/rsyslog.conf on the central server
    # Provides UDP syslog reception
    $ModLoad imudp.so
    $UDPServerRun 514
  2. configure a template to organize the storage of inbound logs
    $template DynamicFile,”/var/log/%HOSTNAME%/forwarded-logs.log” . -?DynamicFile
  3. configure firewall to accept inbound connections over port 514/udp

-On the forwarding server, edit the /etc/rsyslog.conf file and add the following line to the Rules section: . @IP
-Where IP is the IP
-address of the
-destination log
-storage server.
-Restart the rsyslogd on both servers.

  1. On forwarding server, type “ logger TEST “and search /var/log for a dir of the forwarding server and an entry
24
Q

Configure network time NTPd (daemon)

older service

A

synchronizes system time against 1 more more specified time servers over port 123/udp.
Configure: define time servers by editing /etc/ntp.conf
- add “server
{timeserver-IP-
address}” entry

restart service

25
when is chrony better than ntpd
when Linux deployments lack constant or consistent network connections, time cant be accurately or immediately synchronized time settings.
26
Configure chrony latest service
Uses port 123/udp edit chrony configuration file /etc/chrony.conf view detail configs, status, and sync info with: chronyc -n tracking chronyc activity
27
cron jobs
primary Linux schedular is cron. the tool references a crontab file to determine if a task has been assigned. cron jobs can be used to specify tasks each min, hr, day, month, week day.
28
cron date format
" * * * * * " * min (0 - 59) * hour (0 - 23) * day of month (1 - 31) * month (1 - 12) *day of week (0 - 6)
29
/etc/crontab
system wide crontab file
30
/var/spool/cron/crontabs
a per-use crontab
31
crontab -e crontab [options]
like visudo - its the formal way to edit the cron daemon. cron configurations rely on crontab file Editing the file is used to schedule events
32
at cmd at [options] {time}
runs a task once at the specified time. flexible as it can be specify a date and time or to run after a given time period. used in an interactive manner where " at {time} " once executed with pop and interactive menu to specify task. - Ctrl + D exits can be used noninteractively by piping "at {time}" ex: echo "Hi" | at 3 pm time arguments excepts: -noon -12:00 p.m. -teatime - 4:00 p.m. -midnight - 12:00 a.m. -now + # {minutes | hour} - time # {min | hr} from now
33
crony vs at
cron scheduling executes at every occurrence of date/time . at only executes task once and must be made against with the same command to execute similar task
34
what other files can schedule events
systemd .timer files from unit files: /etc/systemd/system
35
configure an Apache web server
1. edit /etc/httpd/conf/httpd.conf file. -find Listen and add next to it {localhost | 127.0.0.1}:80 ex: Listen localhost:80 -find DocumentRoot and add "/var/www/html" next to it like Listen ex: DocumentRoot "/var/www/html" indicates to listens for connections to itself over port 80 and where the file that make up the website are found 2. configure firewall to permit inbound http connections (80/tcp) firewall-cmd --permanent --zone=public --add-service=http ^(all one line) firewall-cmd --reload 3. use a text editor to create a simple test web page and save as index.html note: rename old index file 4. change ownership and grp of the file to Apache chown apache:apache /var/www/html/index.html 5. enable and start/restart service systemctl enable httpd systemctl {start | restart} httpd 6. launch browser to display webpage firefox http://localhost
36
configure NFS permits file sharing and accessing over the network from a central server
1. deploy NFS server and install, enable, and start service. systemctl enable nfs-server systemctl start nfs-server 2. create or select directories on file server that should be shared/exported over network. note these and possible required permissions 3. Edit /etc/exports file to make these resources available over network -must use absolute path ex: {(dir | file) path} {Network ID/CIDR} ({privileges - symbolic}, sync) the dir/file will be available to clients connecting from that subnet and have specified privileges {(dir | file) path} *(ro, sync) the dir/file can be accessible from any client IP, the "ro" permission specifies read-only (optional) 4. restart service 5. might need to configure firewalls for NFS connections: 111/tcp (and udp) plus 2049/tcp (and /udp)
37
Configure NFS clients
1. display available directories on remote file server showmount -e {remote -server-IP-address} 2. on client, mount exported dir to a local mount point can create subdir int /mnt for nfs-share mount -t nfs4 {remote-server-IP}:{NFS dir | file} {mount-point} can mount -t samba2 work?
38
CUPS
print management system for Linux enable a computer to be a print server. CUPS host can initiate client print jobs. it can process different data formats on the same server.
39
How to manage CUPS?
provides a web-based interface for configuring the service .
40
/etc/cups/cupsd.conf /etc/cups/cups-files.conf
CUPS configuration files that the provided CUPS web-based interface modifies
41
CUPS configuration
1. install service and start systemctl enable cups system start cups 2. open fire wall to CUPS port 631/tcp 3. management interface is access from web: http://localhost:631
42
what is lpr
submits files via the command line for printing, and are sent to a default printer unless specified a printer to print or queue.
43
lpr options cmd -E -P {destination} -# {copies} -T {name} -l -o {options} -p -r lpr [options] {file}
-E - force encryption -P {destination} - specify printer -# {copies} - copies 1-100 -T {name} - set job name -o {option} set job option like landscape mode, scale output, double-sided etc. -p print specified files with shaded header including date, time, job name, page # -r printed files should be deleted after printing
44
lpq cmd
display existing print jobs a printer is managing
45
date cmd and options
print date in specified format formation date is an argument with with preceding "+" ex: date +[argument] - %A - Display the full weekday name. -%B - Display the full month name. -%F - Display the date in YYYY-MM-DD format. -%H - Display the hour in 24-hour format. -%I - Display the hour in 12-hour format. -%j - Display the day of the year. -%S - Display seconds. -%V - Display the week of the year. -%x - Display the date representation based on the locale. -%X - Display the time representation based on the locale. -%Y - Display the year.
46
/etc/localtime
maintains date of system format: <24 hour time ##:##:##>
47
change systems date
date -s
48
timedatectl cmd timedate [option] [subcommand]
set system date and time info subcommand: status - show current settings restart - sync local (system) clock base on hardware list-timezones set-timezones {time-zone} ex: timedatectl set-timezone "America/Denver" set-time {HH:MM:SS} options: -H execute on remote host specified by IP or hostname --no-ask-password prevent user being asked to authenticate when performing a priv task --adjust-system-clock sync system clock to real-time clock -M {local container} execute on local container
49
/usr/share/zoneinfo/
store regional time zones and can use to trouble shoot. they are special files and to change time zone, create a sym link to on of the time zones in /etc/localtime file