Skip to content
Send an email notification when somebody connects by SSH
Shell HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
libbash @ c792517


Get an email when somebody connects to ssh. This script is called by sshrc file and send an email notification every time somebody make a successful connection by SSH.

How it works

ssh-notify writes an entry in a log file every time someone make a successful connection by SSH then it sends an email. In the config file, you can set a period of time to avoid receiving multiple times the same email. For example, if the last connection is less than 1 hour, you will not reveive another email.


  • bash
  • sendmail


Debian/Ubuntu package

  1. Download the last version of ssh-notify here
  2. Run dpkg -i ssh-notify-X.X.X.deb

Manual install

  1. Clone this repository: git clone
  2. Update submodules: git submodule update --init
  3. Run


  1. Edit /etc/ssh/ssh-notify.conf
  2. Add all users you want to monitor in ssh-notify group
  3. (optionnal) If you want to secure access to the log file, you can enable the sudo mode in config then add the following line in /etc/sudoers.d/ssh-notify:
%ssh-notify ALL = NOPASSWD:/path/to/ssh-notify/


Debian/Ubuntu package

Run apt remove ssh-notify

Manual install



ssh-notify is licensed under the MIT License. See for the full license text.


Author: Jean Prunneaux

Source code:

Report a bug or request for a feature here.

You can’t perform that action at this time.