↑ ↓ select, Enter open, Esc close

Show outgoing SMTP connections and their processes

Adjust the values, the command updates live
root@server
ss -Htnp state established '( dport = :25 )'

Lists all established TCP connections whose destination port is the given port, with the remote address and the responsible process including its PID. Normally only the mail server (Postfix or qmail) opens such connections. If php-fpm, php or an unknown process shows up here, a compromised script is probably sending spam directly.

Note: ls -l /proc/PID/cwd reveals the working directory of the process and often the affected website.

Also searched as

  • find which process is sending spam
  • show outgoing connections port 25
  • php script sending spam find

Related one-liners

All in Network

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.