tags:

views:

76

answers:

2

I want to get the alert message for every execution of the scp command. If some one access my file using the scp command, that time I have to receive one mail. How can I achieve this. Please help me.

+4  A: 

Unless you have administrative control of the server, what you ask is not possible -- Unix filesystems simply don't work that way. You can set your file permissions so that other users can't find or read your files, but there is no way for you, as an unprivileged user, to request email notification upon attempted or successful access attempts, via scp or any other method.

Jim Lewis
On Linux, you can do this with inotify.
William Pursell
+1  A: 

Are you on the server, or client side?

server side: Key-based ssh authentication has the ability to start custom commands when the user log into the system (can by bypassed if the user can change the authorized_keys file). There you can add a hook to send a mail on the login, or start a own sftp server with the desired logging enabled.

Rudi