As root, you can use the pkill command to kill all processes for a specific user. To kill all processes for all logged-in users, you can combine pkill with the who command to get a list of logged-in users, like so:
for user in $(who | awk '{print $1}'); do pkill -KILL -u $user; done
This will loop through each logged-in user, use pkill to send a SIGKILL signal to all their processes, effectively terminating them. Note that this is a very aggressive way to terminate processes and should only be used if absolutely necessary, as it can cause data loss and other issues.