Unit 6: Processes and services · Lesson 4 of 6 · 14 min
Signals
kill sends a numbered signal. Learn which one to send and who you can send it to.
mission
- You are
- You are practising process control before touching anything real.
- Situation
- Stopping the wrong process, or stopping it the wrong way, can corrupt data.
- Goal
- Start a harmless process, stop it politely and see what you are not allowed to stop.
Start and stop your own process
sleep 600 & [1] 417 ps -o pid,user,args -p 417 PID USER COMMAND 417 learner sleep 600 kill 417 jobs [1]+ Terminated sleep 600
you should see Your PID will differ. kill with no option sent TERM and sleep ended.
Name the signals
kill -l TERM 15 kill -l 9 KILL kill -l 1 HUP
defender tip Try TERM first and give it a few seconds. KILL cannot be caught, so the process cannot save its work.
Try someone else's process
kill $(pgrep sync-agent)
bash: kill: (12) - Operation not permitted
you should see You can signal only your own processes. Stopping dana's listener is a job for root, after the evidence is saved.
What a defender takes away
- 1kill sends TERM, 15, by default.
- 2KILL, 9, is the last resort.
- 3Contain after you collect evidence, not before.
Questions
0 of 2 solved
Answer each one from what you find on your lab machine.