For example if someone is trying to SSH into another server or connect to another server from my Ubuntu server?
Is there a log file for this?
12 Answers
Unfortunately not by default. You can use your firewall to create one. Assuming you are using ufw:
# ufw allow out log to any proto tcp port 22Will log all outgoing connections to any server on tcp port 22. The location of the logfile should be /var/log/ufw.log but it might log it to /var/log/kern.log or /var/log/syslog depending on rsyslog's configuration.
Yes there is use the following command to check that:
sudo journalctl -u sshIn case the log is too long you can pipe that into tail or head depending on which part of the records you want to see:
sudo journalctl -u ssh | [tail | head] 2