WLSS Flashcards

1
Q

Debian Network Settings (persistent and non-persistent)

A

Via ip commands

  • ip link
  • ip addr
  • ip route
    Persistent via
  1. ifupdown
    1. /etc/network/interfaces
  2. systemd-networkd
  3. NetworkManager (GUI)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

RHEL Network Settings (persistent and non-persistent)

A

Via ip commands

  • ip link
  • ip addr
  • ip route

Persistent via

  • nmtui
  • nmcli
  • /etc/sysconfig/network-scripts/ifcfg-<device></device>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Applying the network config changes on Debian and RHEL

A

Debian:

  • /etc/network/interfaces: ifdown <device> and ifup <device>
  • systemd-networkd: networkctl reload

RHEL:

  • nmcli connection up <device>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what will this do?
> find . -name h*

A

find files and directories starting with letter h starting from current working directory

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

What is *,?,[abcd],[a-d],[^ab] or [!ab]

A

Filename Expansion:
* = 0 (inclusive!!) or more characters
? = exactly 1 character
[abcd] = exact 1 character, but only those that are listed
[a-d] = exact 1 character, but only those within the given range (here: a until d)
[^ab] = exact 1 character, EXCEPT these letters

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

What is {a,b,c},{0..6} and {0..6..2}

A

Brace expansion:
{a,b,c} : Generate each of the listed characters (here: a, b, c)
{0..6} : Generate each of the characters with the given range (here: 0,1,2,3,4,5,6)
{0..6..2}: Generate each of the characters with the given range, with an increment (here: 0,2,4,6)

⇒ No need to match existing filenames.

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

what is $()

A

notation of command substitution
~$ du /etc > log-$(date +%Y-%m-%d)
~$ ls
log-2017-09-29

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

what is the notation of command substitution and what is the use

A

$( ) => Use output of commands

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

What is $(( ))

A

Arithmetic expansion:
~$ a=5
~$ b=4
~$ echo De som is $((a+b))
De som is 9

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

What is arithmetic expansion notation and what does it do?

A

$(( )) => does calculations

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

What do these do?
command 2>&1 >/dev/null

A

command 2>&1 >/dev/null:
Redirect output to trash and write errors to standard output
Thus: only keep the errors and be able to do something with it via e.g. pipes

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

What are the different shells?

A
  • **bash****
    • Based on original Bourne shell, sh and implements useful features from ksh and csh
  • **tcsh****
    • Syntax resembles more C language, derivative of original csh (Berkely Unix C Shell)
  • **dash:** Debian Almquist shell
    • Aims to be as small as possible, default non-interactive shell in Ubuntu/Debian
  • **zsh:** Z shell
    • Extended Bourne shell, Default shell in macOS Catalina and Kali 2020.4
  • Others:
    • **ksh:**** Korn shell
    • **fish:** friendly interactive shell
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

where are all shells listed?

A

/etc/shells

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

how to change user login shell?

A

chsh or usermod --shell <shell> <user>

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

where is login shell for each user stored?

A

/etc/passwd

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

What shell am I currently running? (command)

A

ps -p \$\$ or $0

17
Q

what is $SHELL

A

Default shell, NOT the one running

18
Q

what is the restricted shell?

A

rbash or bash -r (easy to bypass)

19
Q

/usr/sbin/nologin

A

Not listed in /etc/shells

⇒ When assigned as default shell, user cannot use interactive shell

<aside>
💡 it makes sense to use nologin when u want to make user that can use e.g. ftp or sftp (so it has valid, unlocked password), but not log in to the machine to do work on it.

</aside>

20
Q

/etc/nologin

A

if exists and readable, login will allow access only to root.
=> Temporarily disabling all unprivileged logins