Examining and Manipulating with Processes and their Actions Flashcards

1
Q

Which command provides detailed information about files that are opened by processes?

A

lsof

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

How does lsof help with a security analysis of a workstation?

A

helps to identify unauthorized or unexpected file accesses, which might indicate a security breach

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

How does lsof help to track network connections?

A

by listing all network sockets in use, including TCP and UDP ports

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

Which lsof flag lists all network connections and is useful in identifying open network sockets and the processes using them?

A

-i
~~~
ubuntu@ubuntu-cloud:~$ sudo lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 704 root 3u IPv4 22607 0t0 TCP *:ssh (LISTEN)
sshd 704 root 4u IPv6 22609 0t0 TCP *:ssh (LISTEN)
apache2 734 root 3u IPv6 22696 0t0 TCP *:http (LISTEN)
apache2 736 www-data 3u IPv6 22696 0t0 TCP *:http (LISTEN)
apache2 737 www-data 3u IPv6 22696 0t0 TCP *:http (LISTEN)

~~~

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

Which lsof flag lists all TCP connections?

A

sudo lsof -iTCP

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

Which lsof flag lists all UDP connections?

A

sudo lsof -iUDP

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

Which lsof flag shows open files belonging to a specific user?

A

lsof -u {username}

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

Which lsof flag shows files opened by a specific process ID (PID)?

A

lsof -p {pid}

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

Which lsof flag avoids converting network numbers to host names?

A

sudo lsof -i -n
~~~
ubuntu@ubuntu-cloud:~$ sudo lsof -i -n
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 736 www-data 3u IPv6 22696 0t0 TCP *:http (LISTEN)
apache2 737 www-data 3u IPv6 22696 0t0 TCP *:http (LISTEN)
snapd 1226 root 17u IPv4 28570 0t0 TCP 10.0.80.80:55236->185.125.190.26:https (ESTABLISHED)
~~~

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

How to do montiroring of a specific directory every 2 seconds for real-time observation with lsof?

A

lsof +D /path/to/directory -r 2

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

How to use lsof to list files using a specific network port?

A

sudo lsof -i:{port}

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