1

I have a CentOS 6.2 server.

Whenever some one logs into the server using the terminal (SSH) the user profile (.bash_profile) is loaded.

Now my question is, is there a profile that loads whenever you use SFTP to login into the server via "FTP browsing software" ( I use WinSCP ), I want to send an email whenever a user logs into the server via SFTP. I already have the code to do this when a user logs into the terminal (SSH) when his profile loads.

Thanks

4

This is the wrong way to go about getting login notifications, as users can change their profile or defeat this in a myriad of ways.

Instead, write a little script that watches your auth log and sends email when someone authenticates successfully.

2
  • I agree that this method would be the best but with my level of linux knowledge this would be a very tough challenge. I will only have 1 user (root), we are setting up a rule that this server can only be accessed by a few people only and whenever they do use that user to access the server we want to get an email. This is only to track unscheduled in user login into the server, this server can only be accessed internally.
    – Alex
    Oct 12 '12 at 9:20
  • Do it the right way the first time. It's just not worth taking shortcuts. Perhaps look into fail2ban. That could possibly be conscripted to send these emails.
    – EEAA
    Oct 12 '12 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.